Logo
MicroStrategy REST API API Documentation

Create a user hierarchy

POST {{baseUrl}}/api/model/hierarchies

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

User hierarchies have different subtypes. Currently, we support the following subtypes: * dimensionuser: This user hierarchy is for drilling. * dimensionuser_hierarchy: This user hierarchy is for browsing.

In the request body, there are four main parts: * Information: Stores basic user hierarchy information such as name, subType, destinationFolderId, etc. name is required field. * UseAsDrillHierarchy: This Boolean field indicates the user hierarchy subtype. False means the subtype is dimensionuserhierarchy; otherwise, it is dimension_user. This field is required. * Attributes: Stores the hierarchy attributes for the user hierarchy in a list. Each hierarchy attribute contains an objectId, name, entryPoint, filters, elementDisplayOption, and limit. objectId, entryPoint, and elementDisplayOption are required fields. * Relationships: Stores the hierarchy relationships for the user hierarchy in a list. Each hierarchy relationship contains parent, and child. parent and child are required fields.

Each user hierarchy should have at least one entry attribute for browsing. The entryPoint field in a hierarchy attribute is Boolean. It indicates whether the current attribute is a single entry point attribute.

Users can define filters and element display options to control element display for each hierarchy attribute.

ElementDisplayOption contains the following values: * allelements: This attribute shows all elements when browsing. * noelements: This attribute does not show any elements when browsing. * limitedelements: This attribute shows limited elements when browsing, within the defined limit. The limit field is only required for limitedelements.

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 user hierarchy to the metadata, commit using the changeset commit API.

 

Body PARAM

Key Datatype Required Description 



HEADERS

Key Datatype Required Description 
X-MSTR-AuthToken
string (Required) Authorization Token
X-MSTR-MS-Changeset
string (Required) Changeset ID
X-MSTR-ProjectID
string
Content-Type
string




RESPONSES

Curl
curl -X POST 'baseUrl/api/model/hierarchies' -H 'X-MSTR-AuthToken: authToken' -H 'X-MSTR-MS-Changeset: rd_changesetId' -H 'X-MSTR-ProjectID: projectId' -H 'Content-Type: application/json' -d '{"information":{"destinationFolderId":"publicObjectsFolderId","subType":"dimension_user","name":"Time_New"},"useAsDrillHierarchy":true,"attributes":[{"objectId":"8D679D4411D3E4981000E787EC6DE8A4","name":"Month","entryPoint":true,"elementDisplayOption":"all_elements"},{"objectId":"8D679D4511D3E4981000E787EC6DE8A4","name":"Month of Year","entryPoint":true,"elementDisplayOption":"all_elements"}],"relationships":[{"parent":{"objectId":"8D679D4511D3E4981000E787EC6DE8A4","subType":"attribute","name":"Month of Year"},"child":{"objectId":"8D679D4411D3E4981000E787EC6DE8A4","subType":"attribute","name":"Month"}}]}'

ENDPOINTS