Adding Cloud Usage Meter 9.0 Integrations Using API Session Tokens
search cancel

Adding Cloud Usage Meter 9.0 Integrations Using API Session Tokens

book

Article ID: 445934

calendar_today

Updated On:

Products

VMware Usage Meter

Issue/Introduction

  • When migrating or deploying a new VMware vCloud Usage Meter instance, administrators may attempt to automate the configuration of product integrations using the API. During this process, API authentication failures or difficulties generating a valid session token via tools like Postman or custom scripts may occur, preventing the successful automated addition of product integrations.

Environment

  • VMware vCloud Usage Meter 9.0

Resolution

To successfully automate the configuration of integrations on a new vCloud Usage Meter instance, utilize the correct API syntax to generate a session token and subsequently add the products.

  1. Generate the session token using a POST request to /api/v2/auth with Basic Authorization:
    curl --request POST \
      url 'https://<UM_URL>/api/v2/auth' \
      header 'accept: application/json' \
      header 'authorization: Basic <BASE64 UM_USER:UM_PASS>'
  2. Using the access token generated in step 1, add the product integration (e.g., NSX-T) using a POST request to /api/v1/product with Bearer Token Authorization:

    curl --request POST \
      url 'https://<UM_URL>/api/v1/product' \
      header 'accept: application/json' \
      header 'authorization: Bearer <UM_ACCESS_TOKEN>' \
      header 'content-type: application/json' \
      data '{
    "productType": "NSX-T",
    "user": "<NSXT_USERNAME>",
    "password": "<NSXT_PASSWORD>",
    "host": "<NSXT_URL>",
    "port": <NSXT_PORT>,
    "forceCreation": true
    }'
  3. Repeat step 2 for any additional product integrations required.

Additional Information