Logo
MicroStrategy REST API API Documentation

Create a new cube

POST {{baseUrl}}/api/model/cubes

Create a new attribute in the changeset, based on the definition provided in request body. The definition of the newly created attribute is returned in response.

In the request body, forms contains the detailed definition of a list of attribute forms. Each attribute contains one or more attribute forms. Each attribute form contains: * expressions: A list of attribute form expressions. Attribute form contains one or more attribute form expressions. Each attribute form expression contains expression and tables.
* ”expression”: Needs to be in either tree or tokens format. * Tokens are a semi-structured representation of MicroStrategy expression text that includes object references. For example, let’s say an attribute form expression is Year - 10. When the attribute form expression is represented as tokens, the text is broken down into pieces (tokens) with information about what these pieces represent in the metadata: (Year_ID, YearcolumnID), (-, Minus_ID), (10, Constant). * tables: A list of tables that the expression applies to.
* dataType and alias are optional. If omitted, they are calculated based on the first attribute form expression. * childForms is specific to a form group, which contains the reference for child forms

Provide a lookup table on either the attribute level or attribute form level, as it is required for the object to be committed to the metadata. A lookup table can be defined on the attribute level using attributeLookupTable, or the attribute form level using lookupTable. If LookupTable is defined at the attribute form level, it is used, or it falls back to attributeLookupTable.

Provide keyForm and displays, as they are required for the attribute to be committed to the metadata.

Provide destinationFolderId in information, as it is required for the attribute to be committed to the metadata.

The changeset ID can be obtained using the changeset creation API. An authorization token is required to execute the request and can be obtained using Authentication endpoints.

To save the newly created attribute to the metadata, commit using the changeset commit API.

 

Body PARAM

Key Datatype Required Description 
cubeTemplateId
null This parameter specifies a cube object that will be used as a template for new cube creation. The new cube will inherit the defintion of this cube, and can be overwritten through request body of POST /model/cubes. If ommitted, the new cube will be created based on a blank cube.
showExpressionAs
null 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. Available values : tokens, tree
showFilterTokens
null Specify whether the cube "filter" is returned in "tokens" format, along with "text" and "tree" formats. The cube filter is presented in the following formats: "text": A human readable, but non-parsable text, describing a filter's qualification. "tree": A tree data structure fully defining the filter's qualification. "tokens": A list of parsed tokens that define a filter's qualification. Be aware that generating tokens requires additional time. If omitted or false, only "text" and "tree" formats are returned. If true, all "text", "tree" and "tokens" formats are returned.



Curl
curl -X POST 'baseUrl/api/model/cubes?cubeTemplateId=&showExpressionAs=&showFilterTokens=' -H 'X-MSTR-AuthToken: authToken' -H 'X-MSTR-ProjectID: projectId' -d '{"information":{"subType":"report_cube","name":"Test Cube(Year, Category Analysis)","destinationFolderId":"publicReportsFolderId"},"template":{"rows":[{"id":"8D679D5111D3E4981000E787EC6DE8A4","name":"Year","type":"attribute"},{"id":"8D679D3711D3E4981000E787EC6DE8A4","name":"Category","type":"attribute"}],"columns":[{"type":"metrics","elements":[{"id":"7FD5B69611D5AC76C000D98A4CC5F24F","name":"Cost","subType":"metric"},{"id":"4C051DB611D3E877C000B3B2D86C964F","name":"Profit","subType":"metric"}]}]},"filter":{"text":"(Subcategory = Art \u0026 Architecture, Business, Computers, Electronics - Miscellaneous) And (Revenue \u003e 100000)","tree":{"function":"and","children":[{"type":"predicate_element_list","predicateId":"34BD0D556AC6423CB8061BB90A0C1AB2","predicateTree":{"attribute":{"objectId":"8D679D4F11D3E4981000E787EC6DE8A4","subType":"attribute","name":"Subcategory"},"elements":[{"display":"Art \u0026 Architecture","elementId":"h11"},{"display":"Business","elementId":"h12"},{"display":"Computers","elementId":"h23"},{"display":"Electronics - Miscellaneous","elementId":"h24"}],"function":"in"}},{"type":"predicate_metric_qualification","predicateId":"EF616BAECDED4AE0A91C6A4A5092ED92","predicateText":"(Revenue \u003e 100000)","predicateTree":{"function":"greater","parameters":[{"parameterType":"constant","constant":{"type":"double","value":"100000.0"}}],"levelType":"none","metric":{"objectId":"4C05177011D3E877C000B3B2D86C964F","subType":"metric","name":"Revenue"},"metricFunction":"value","isIndependent":0,"nullInclude":0}}],"type":"operator"}},"options":{"dataLanguages":{"dataLanguageType":"project_default"},"dataRefresh":"replace","dataPartition":{"numberOfPartitions":0,"fetchDataSlicesInParallel":false}}}'

ENDPOINTS