You can use the Omnissa Commerce Portal API to get information about your users, contracts, monthly billing orders (MBOs), and deals with Cloud Services Providers. To interact with the Commerce Portal API, you generate an API token in Commerce Portal and exchange it for a bearer token.
How do I generate an API token?
As an Administrator user, you generate an API token in your profile settings.
-
On the Commerce Portal toolbar, expand the drop-down menu next to your user name and click Profile.
-
Navigate to Access Tokens and click GENERATE TOKEN.
-
Enter a token name, select its expiration date and roles, then click GENERATE.
-
Copy or save the generated token and click CLOSE.
The token is generated and appears in the list of active tokens.
To revoke a token or change its expiration date, click the ellipsis-vertical button (
) and select one of the options.
How do I exchange an API token for a bearer token?
Before you can make authorized requests to the Commerce Portal API, you need to exchange your API token for a bearer token.
Call the authentication API and exchange your API token for a bearer token.
curl https://ocp.omnissa.com/api/commerce/v1/auth \
-H 'Content-Type:application/json' \
-d '{"type":"UserToken","userToken":"yourAPIToken"}'
The response returns your bearer token in the "accessToken" parameter.
{
"tokenType":"bearer",
"accessToken":"eyJhbGciOiJIUzUxMiJ9.
eyJhdWQiOiJTRVNTSU9OIiwiY29udGV4dCI6IjZmYWExZDM2LTE2NTUtNGY4Ny04ZWE3LWU0NGI0ZTM1MzQ2\
MSIsImlhdCI6MTY1NDgzODc2NSwiZXhwIjoxNjU0ODQwNTY1fQ.
W9UCFRPNLpJK1JHKiBSODdjdyRqSBhq6jq7y5JkccmV5Gsw34zXrwiZcFECmhorvk5XW4Ow-1e0zGSR_if8AEQ",
"expiresIn":1800
}
How do I use the bearer token in subsequent API requests?
After you obtain your bearer token, you set it as the HTTP "Authorization" header to authorize subsequent API requests. The correct format to use is "Authorization: Bearer your_accessToken".
The example below shows how a bearer token is used in a GET request.
curl https://ocp.omnissa.com/api/aggregator/v1/contracts \
-H "Accept: application/json" \
-H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJhdWQiOiJTRVNTSU9OIiwiY29udGV4dCI6IjZmYWExZDM2LTE2NTUtNGY4Ny04ZWE3LWU0NGI0ZTM1MzQ2MSIsImlhdCI6MTY1NDgzODc2NSwiZXhwIjoxNjU0ODQwNTY1fQ.W9UCFRPNLpJK1JHKiBSODdjdyRqSBhq6jq7y5JkccmV5Gsw34zXrwiZcFECmhorvk5XW4Ow-1e0zGSR_if8AEQ"
Was this page helpful?