Logo
MicroStrategy REST API API Documentation

Create the definition of a multi-table dataset

POST {{baseUrl}}/api/datasets/models

Create the definition of a dataset containing one or more tables. The definition includes the name and description of the dataset and the name and description of each table, attribute, and metric within the dataset. You obtain the authorization token needed to execute the request using POST /auth/login. You obtain the project ID using GET /projects. You pass the authorization token and the project ID in the request header. You provide the information used to create the dataset definition in the body parameter of the request; you specify the name and description of the dataset, the ID of the folder where the dataset definition will be saved, and a description of the tables, attributes, and metrics in the dataset. If the folder ID is not provided, the dataset will be saved in the user's My Reports folder. For each table in the dataset, you provide the name of the table and the name and datatype of each column in the table. For each metric in the dataset, provide the name of the metric, the names of all of the tables that include that metric, and the name of the column in each table that holds the metric. For each attribute in the dataset, provide the name of the attribute, the attribute form, the names of all of the tables that include that attribute, and the name of the column in each table that holds the attribute. Valid attribute forms are ID or DESC; longitude and latitude attribute forms are not supported. This request returns the name and ID of the dataset.

To create a multi-table dataset, use the requests in the order shown below:

  1. POST /datasets/models
  2. POST /datasets/{datasetId}/uploadSessions
  3. PUT /datasets/{datasetId}/uploadSessions/{uploadSessionId}
  4. POST /datasets/{datasetId}/uploadSessions/{uploadSessionId}/publish
  5. GET /datasets/{datasetId}/uploadSessions/{uploadSessionId}/publishStatus

Note: datasets created by this API can only be published or republished by APIs under /datasets/{datasetId}/uploadSessions endpoint.

 

Body PARAM

Key Datatype Required Description 
fields
null Comma-separated, top-level field whitelist that allows the client to selectively retrieve part of the response model. If specified, extra filtering is applied, and for top-level object (if root model is an array, each array element), only the listed fields are kept in the response. For example, "id,elements" keeps only the "id" field and whole "elements" array field, omitting all other fields in the top-level response model.



HEADERS

Key Datatype Required Description 
X-MSTR-AuthToken
string (Required) Authorization token
X-MSTR-ProjectID
string (Required) Project ID
Content-Type
string




RESPONSES

Curl
curl -X POST 'baseUrl/api/datasets/models?fields=' -H 'X-MSTR-AuthToken: authToken' -H 'X-MSTR-ProjectID: projectId' -H 'Content-Type: application/json' -d '{"name":"SALES_TABLE_V2","description":"product","folderId":"rd_folderId","tables":[{"name":"SALES_TABLE","columnHeaders":[{"name":"ID","dataType":"STRING"},{"name":"SALES","dataType":"DOUBLE"}]}],"metrics":[{"name":"Sales","expressions":[{"tableName":"SALES_TABLE","columnName":"SALES"}]}],"attributes":[{"name":"ID","attributeForms":[{"category":"ID","expressions":[{"tableName":"SALES_TABLE","columnName":"ID"}]}]}]}'

ENDPOINTS