Logo
MicroStrategy REST API API Documentation

Create a derived element in report through Modelling Service

POST {{baseUrl}}/api/model/reports/:reportId/derivedElements

This API creates a derived element in report. When creating a derived element, the API also creates a list of the derived element's elements defined in the request body and then returns the full definition of the newly created derived element.

The request body must include the objectInfoReference of the attribute whose attribute elements you intend to group. For normal report and free form SQL report, the attribute must exist in dataTemplate. For subset report, the attribute must exist in viewTemplate.

A report instance ID is required to execute the request, and it can be obtained using the report instance creation API. An authorization token is required to execute the request and can be obtained using Authentication endpoints.

Set Prefer to respond-async to execute this API asynchronously. Use GET /model/reports/{reportId}/derivedElements/{derivedElementId} API to check the status.

The newly created derived element will be saved to metadata together with report, using the POST /model/reports/{reportId}/save API.

 

Body PARAM

Key Datatype Required Description 
executionStage
string This parameter specifies the execution stage the report is executed to. Available values: resolve_prompts, execute_data, no_action. If omitted, it is "no_action". __Available values__ : resolve_prompts, execute_data, no_action
showExpressionAs
string This parameter specifies the format in which the expressions are returned in response. This parameter applies to the expressions in a fact or attribute and custom expressions used in a filter, prompt, security filter, custom group, etc. Expressions are presented in the following formats: * "text": A human readable, but non-parsable text, describing the expression. This is the default format that is always returned in the response. * "tree": A tree data structure fully defining the expression. This format can be used if you want to examine and modify the expression programmatically. * "tokens": A list of parsed tokens. This format can be used if you want to examine and modify the expression using the parser component. Note that generating tokens requires additional time. Tokens are a semi-structured representation of MicroStrategy expression text that includes object references. For example, let’s say a filter expression is "Revenue > Cost". When the filter expression is represented as tokens, the text is broken down into pieces (tokens) with information about what these pieces represent in the metadata: ("Revenue", Revenue_ID), (">", GreaterThan_ID), ("Cost", Cost_ID). If omitted, the expression is returned in "text" format. If `tree`, the expression is returned in "text" and "tree" formats. If `tokens`, the expression is returned in "text" and "tokens" formats.



HEADERS

Key Datatype Required Description 
X-MSTR-AuthToken
string (Required) Authorization token
X-MSTR-MS-Instance
string (Required) Report instance ID
Curl
curl -X POST 'baseUrl/api/model/reports/:reportId/derivedElements?executionStage=execute_data&showExpressionAs=tree' -H 'X-MSTR-AuthToken: authToken' -H 'X-MSTR-MS-Instance: rd_reportInstanceId' -H 'Prefer: respond-async' -d '{"information":{"name":"New Derived Element"},"attribute":{"objectId":"8D679D3C11D3E4981000E787EC6DE8A4"},"elements":[{"name":"Age under 34","type":"list","elements":[{"display":"Under 24","elementId":"h1"},{"display":"25 to 34","elementId":"h2"}]},{"name":"All Other","type":"all_other"}]}'

ENDPOINTS