Skip to main content

January 16, 2025

How Do I Use the Commerce Portal API as a Cloud Services Provider

You can use the Omnissa Commerce Portal API to get information about your contracts, users, and monthly billing orders (MBOs). You can also submit MBOs. 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.

  1. On the Commerce Portal toolbar, expand the drop-down menu next to your user name and click Profile.

  2. Navigate to Access Tokens and click GENERATE TOKEN.

  3. Enter a token name, select its expiration date and roles, then click GENERATE.

  4. 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 (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 your 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/provider/v1/contracts \
-H "Accept: application/json" \
-H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.
eyJhdWQiOiJTRVNTSU9OIiwiY29udGV4dCI6IjZmYWExZDM2LTE2NTUtNGY4Ny04ZWE3LWU0NGI0ZTM1MzQ2MSIsImlhdCI6MTY1NDgzODc2NSwi
ZXhwIjoxNjU0ODQwNTY1fQ.W9UCFRPNLpJK1JHKiBSODdjdyRqSBhq6jq7y5JkccmV5Gsw34zXrwiZcFECmhorvk5XW4Ow-1e0zGSR_if8AEQ"

Was this page helpful?

Provide feedback for this topic

Was this topic helpful?

Please do not include any personal or confidential information.

Generating link…