Skip to main content

Object prompts

tip

You can try out this workflow at REST API Playground.

Learn more about MicroStrategy REST API Playground here.

An object prompt allows the caller to supply a list of objects, such as attributes, metrics, hierarchies, and so on from which a selection is made. Folder objects cannot be used in object prompts.

Use REST APIs to perform the following actions on object prompts:

Create a new prompt

  1. To create an object prompt, you must enter the required fields with the correct information, using POST /api/model/prompts.

  2. The response can change based on the request parameters provided by the caller. Use the following parameters.

    LocationNameDescription
    headerX-MSTR-authTokenThe authorization token
    headerX-MSTR-ProjectIDThe ID of the project
    headerX-MSTR-MS-ChangesetThe ID of the changeset
    queryshowExpressionAsThe parameter that specifies the format in which the response is returned.
  3. The model for the definition of an object prompt can be represented using the fields shown below. "objectID", "dateCreated", "dateModified", and "versionId" are automatically generated.

    FieldsNameDescriptionData TypeRequired?
    informationnameThe name of the prompt. This should be a user-friendly name for identifying the prompt.string✔️
    informationsubTypeThe type of prompt. The "subType" for an object prompt is "prompt_objects".string✔️
    informationdestinationFolderIdThe folder ID where the new prompt is saved.string✔️
    titleThe title of the prompt.string
    instructionThe instruction on how to apply the prompt.string
    questionpredefinedObjectsA list of predefined metrics with "objectId", "subType", and "name".string
    questionsearchA standalone search object with "objectId", "subType", and "name". "search" and "predefinedObjects" should have an XOR relationship, since only one of them has a value.string
    defaultAnswerobjectsA list of objects used to define the default answer. Each object should include "objectId", "subType", and "name".string
    restrictionrequiredAn indicator that specifies whether a prompt answer is required or not.boolean
    restrictionallowPersonalAnswersAn indicator that specifies whether personal answers are allowed. It can be set to "none", "single", or "multiple".string
    restrictionminThe minimum number of objects that can be selected.integer
    restrictionmaxThe maximum number of objects that can be selected.integer

    Sample code for creating an object prompt's definition is provided below. "objectID", "dateCreated", "dateModified", and "versionId" are automatically generated.

    {
    "information": {
    "destinationFolderId": "8A1831FF494F528D02A4A8BF5FB73459",
    "subType": "prompt_objects",
    "name": "Search all"
    },
    "title": "Objects",
    "instruction": "Choose objects from the list.",
    "question": {
    "search": {
    "objectId": "4E583DB34D3BE82E7356E0966962CEF0",
    "subType": "search",
    "name": "Search for all objects"
    }
    },
    "restriction": {
    "required": false,
    "allowPersonalAnswers": "none",
    "min": 2
    }
    }

Update an existing prompt

  1. Update the definition of an object prompt using PUT /api/model/prompts/{promptId}.

  2. Provide the following headers in the request:

    LocationNameDescription
    headerX-MSTR-authTokenThe authorization token
    headerX-MSTR-ProjectIDThe ID of the project
    headerX-MSTR-MS-ChangesetThe ID of the changeset
  3. In addition to the above header, you should also provide the ID of the prompt you want to update.

  4. You can modify the fields shown below. The "subType" field is not included below since it cannot be modified through this REST API.

    FieldsNameDescriptionData Type
    informationnameThe name of the prompt. This should be a user-friendly name for identifying the prompt.string
    informationdestinationFolderIdThe folder ID where the new prompt is saved.string
    titleThe title of the prompt.string
    instructionThe instruction on how to apply the prompt.string
    questionpredefinedObjectsA list of predefined metrics with "objectId", "subType", and "name".string
    questionsearchA standalone search object with "objectId", "subType", and "name". "search" and "predefinedObjects" should have an XOR relationship, since only one of them has a value.string
    defaultAnswerobjectsA list of objects used to define the default answer. Each object should include "objectId", "subType", and "name".string
    restrictionrequiredAn indicator that specifies whether a prompt answer is required or not.boolean
    restrictionallowPersonalAnswersAn indicator that specifies whether personal answers are allowed. It can be set to "none", "single", or "multiple".string
    restrictionminThe minimum number of objects that can be selected.integer
    restrictionmaxThe maximum number of objects that can be selected.integer