Skip to main content

Manage Watch KPI and Insight service privileges

Available since 2021 Update 8

A high-level workflow sample for managing Watch KPI and Insight service privileges is shown below. The sequence of REST API requests in the following procedure allows an administrative user to assign server-level privilege for a specific user or user group to use Watch KPI and Insight service.

For the privileges to use Watch KPI and Insight service, please refer to Assign privileges to MicroStrategy Insight.

A detailed explanation of each step is provided below:

Assign privilege to use Watch KPI and Insight service to users

Endpoints:

  • POST /api/iserver/metadata/commands

These endpoints allow administrative users to submit commands to manipulate metadata on IServer. First, you obtain the authorization token needed to execute the request using POST /api/auth/login. Then, you pass the authorization token in the request header. You provide the information in the parameters of the request.

To auto-grant Watch KPI privileges ("Use Library Watchlist" and "Use Library Insight") for Library users (who has "Use Library Web" privilege), you need to call this API with query parameter commandId set to 1.

The example below demonstrates how to assign privilege to use Watch KPI and Insight service to users.

Sample request

Request Parameters:

  • X-MSTR-AuthToken

    The authorization token generated by POST /api/auth/login.

  • commandId

    The command ID defined by IServer. For assigning privileges to use Watch KPI and Insight service, the command ID is 1. The valid command is only 1 for now.

Request Header:

'Accept: application/json'
‘X-MSTR-AuthToken: djoofk6kq8htka6emv15246959’

Request Body:

No request body.

Curl:

curl -X POST "http://localhost:8282/consume-dev/api/iserver/metadata/commands?commandId=1" -H "accept: application/json" -H "X-MSTR-AuthToken: djoofk6kq8htka6emv15246959"

Sample response

Response Header:

access-control-allow-headers: Content-Type
access-control-allow-methods: POST
cache-control: no-store
content-encoding: gzip
content-length: 1307
content-security-policy: frame-ancestors 'self'
content-type: application/json
date: Thu, 27 Feb 2020 00:28:01 GMT
x-content-type-options: nosniff
x-xss-protection: 1; mode=block

Response Body:

The API returns the href to query the status of the submitted command. You can then use the API GET ​/api​/iserver​/queues​/{id} to query the status of the submitted command.

{
"link": {
"href": "/queues/9E4799C94823E297DAC9808357575AF5",
"type": "GET"
}
}

Response Code: 200 (Success)

Query the status of submitted command

The following endpoints, used to query the status of submitted command by the API POST /api/iserver/metadata/commands.

  • GET ​/api​/iserver​/queues​/{id}

Sample request

Request Parameters:

  • X-MSTR-AuthToken

    The authorization token generated by `POST /api/auth/login.``

  • id

    The ID of the submitted command retrieved from the response of POST /api/iserver/metadata/commands on success.

Request Header:

'Accept: application/json'
"X-MSTR-AuthToken": "pdcmrontjrlf494tl1eu6nt7hg"

Request Parameters:

"X-MSTR-AuthToken": " pdcmrontjrlf494tl1eu6nt7hg",
"id": "9E4799C94823E297DAC9808357575AF5"

Curl:

curl -X GET "http://localhost:8282/consume-dev/api/iserver/queues/9E4799C94823E297DAC9808357575AF5" -H "accept: application/json" -H "X-MSTR-AuthToken: cmjt8jfn2ucl260lqtrhh4gips"

Sample response

Response Header:

access-control-allow-headers: Content-Type
access-control-allow-methods: GET
cache-control: no-store
content-encoding: gzip
content-length: 790
content-security-policy: frame-ancestors 'self'
content-type: application/json
date: Thu, 27 Feb 2020 16:38:44 GMT
x-content-type-options: nosniff
x-xss-protection: 1; mode=block

Response Body:

The REST server returns a JSON object that contains the information of the submitted task. Status 3 indicates the command finishes successfully.

{
"status": 3,
"progress": 100,
"iServerErrorCode": 0
}

Response Code: 200 (Success: OK)