To authenticate requests using Skyline Insights APIs, you must have an access token. To generate an access token, you use VMware Skyline Advisor to obtain an API token. Then you use the API token as input to the CSP API to generate an access token.

Prerequisites

Install JSON Command Line processor(jq) to run the curl commands: https://stedolan.github.io/jq/download/

Procedure

  1. In a web browser, go to https://skyline.vmware.com/advisor.
  2. Click the drop-down arrow by your name. Under User Settings, click My Account.
  3. Click the API Tokens tab.
  4. Click GENERATE A NEW API TOKEN to obtain an API token.
  5. Configure the token settings:
    Option Description

    Field Name

    Action

    Token Name

    Enter a token name

    Token TTL

    Enter a number to define how long the API token is valid for (Time To Live).

    Define Scopes

    Scopes provide a way to implement granular access control.

    OpenID

    Check the OpenID box, to scope requests and receives information about authenticated sessions and users of your app.

    Email Preferences

    Select the Email Peferences box to recieve the email reminders when this token is about to expire

    .

  6. Click GENERATE.

    The Token Generated window displays a token with the name that you specified and the name of your organization.

  7. Click COPY to copy the token. Paste the string in a text file and save the file.

    Clicking COPY ensures that you capture the exact string and is more reliable than using your pointer to copy the string.

  8. Click CONTINUE.
  9. To obtain the access token, replace YOUR_API_TOKEN with the generated API token.
    curl -s -X POST "https://console.cloud.vmware.com/csp/gateway/am/api/auth/api-tokens/authorize?grant_type=refresh_token" --header 'Accept: application/json' \ --header "Content-Type: application/x-www-form-urlencoded" --data-urlencode "refresh_token=YOUR_API_TOKEN"| jq -r .access_token

Results

You have successfully generated the API token.