Use the Cloud Pak for Data Platform API to view
the number of users that are using Cognos Dashboards
licenses.
Before you begin
You must be running Linux® with
bash, curl, and jq installed.
You must have curl set up properly with an SSL certificate.
For more information about installing jq, see Installing the jq JSON
command-line utility.
About this task
Your Cloud Pak for Data license limits the number of
users who can create dashboards to a maximum of five users and the number of users who can view
dashboards to 20 users. To make sure that you do not exceed these limits, use the Cloud Pak for Data Platform API to view the number of users with
Create dashboards and View dashboards permissions.
If you exceed these limits, you must purchase a Cognos license:
- For more Create dashboards permissions, purchase the Cognos Analytics User Cloud Pak for Data Subscription license.
- For more View dashboards permissions, purchase the Cognos Analytics Viewer Cloud Pak for Data Subscription license.
Procedure
- Set the required environment variables.
- Set the
CPD_INSTANCE_ROUTE environment variable to the route to your
Cloud Pak for Data web client.
export CPD_INSTANCE_ROUTE=<cpd_instance_route>
By default, this value is
cpd-<namespace>.apps.<OCP-default-domain>.
- Set the
USERNAME environment variable to your Cloud Pak for Data username.
export USERNAME=<username>
- Set the
PASSWORD environment variable to your Cloud Pak for Data user password.
export PASSWORD=<password>
- Generate an authorization token and assign this token to the
AUTHORIZATION_TOKEN variable.
For more information about how to generate an authorization token, see Generating an API authorization token.
Set the AUTHORIZATION_TOKEN environment variable to this authorization
token:
export AUTHORIZATION_TOKEN=${TOKEN}
- Display the number of users with the Create dashboards
permission.
Run the following command to display the number of users with the Create
dashboards permission:
echo -e "\n\n\n>>>>> USERS WITH CREATE DASHBOARDS PERMISSION: \
`curl -L "https://$CPD_INSTANCE_ROUTE/usermgmt/v1/usermgmt/users?permissions=create_dashboard" \
-H "Authorization: ZenApiKey $AUTHORIZATION_TOKEN" | jq -r '.[] | .uid ' | wc -l` <<<<<\n\n\n"
>>>>> USERS WITH CREATE DASHBOARDS PERMISSION: 5 <<<<<
- Display the number of users with the View dashboards
permission.
Run the following command to display the number of users with the View
dashboards permission:
echo -e "\n\n\n>>>>> USERS WITH VIEW DASHBOARDS PERMISSION: \
`curl -L "https://$CPD_INSTANCE_ROUTE/usermgmt/v1/usermgmt/users?permissions=view_dashboard" \
-H "Authorization: ZenApiKey $AUTHORIZATION_TOKEN" | jq -r '.[] | .uid ' | wc -l` <<<<<\n\n\n\"
>>>>> USERS WITH CREATE DASHBOARDS PERMISSION: 20 <<<<<