Wednesday, March 22, 2023
HomeCloud ComputingUtilization Meter Registration and Utilization Report APIs are actually a part of...

Utilization Meter Registration and Utilization Report APIs are actually a part of Cloud Supplier APIs on developer.vmware.com


We’ve got an essential announcement to make – Utilization Meter and Utilization Report APIs are actually a part of the Cloud Supplier Navigator and might be accessed from the Cloud Supplier part on developer.vmware.com. Moreover, there’s a new API for registering Utilization Meter with a contract within the VCPP Commerce Portal. Right here is how the Utilization API web page appears to be like like on developer.vmware.com.

On this weblog put up, we are going to exhibit the steps of registering a Utilization Meter occasion, getting info and downloading utilization studies.

Earlier than utilizing the aforementioned APIs, there are just a few conditions that should be glad.

Conditions

  1. A refresh token generated from Cloud Accomplice Navigator/Consumer Profile/API Tokens. Data might be discovered right here or scroll to the Producing an Entry Token part on this weblog put up.
  2. An entry token generated from the Cloud Accomplice Navigator refresh token. Learn right here or scroll to the Producing an Entry Token part on this weblog put up.

Notice: A generated entry token expires after half-hour so you want to regenerate it infrequently.

Producing an Entry Token for Authentication

To execute the API requests described on this weblog put up, you’ll need to generate a refresh token from Cloud Accomplice Navigator (CPN) after which execute a POST request to the Cloud Companies Portal gateway to get the entry token with which you’ll authenticate with the CPN service – Utilization Perception.

The Utilization Perception service is the service which is able to register your Utilization Meter with a contract within the Commerce Portal and generate studies for a Utilization Meter occasion.

Now let’s see the best way to generate an entry token:

  1. Log in to Cloud Accomplice Navigator.
  2. Change to the group for which you want to register a Utilization Meter or obtain utilization studies.
  3. Below your username, click on My Account.
  4. Click on on the API Tokens tab.
  5. Within the API Tokens web page, click on GENERATE TOKEN.
  6. Copy the token and click on Proceed.

Notice: Save your refresh token someplace as you’ll need it repeatedly to generate an entry token in your utilization API calls.

  1. In your API consumer, make the next POST Request to the Cloud Accomplice Navigator Service Gateway to generate an entry token.

This entry token you’ll use to authenticate with Utilization Perception when sending the request for registering your Utilization Meter with a contract within the Commerce Portal.

See the pattern request and response:

Pattern cURL Code:

Notice: Exchange the refresh token with your personal generated from the CPN API Token web page.

  1. Copy the entry token from the response. Use it when executing the API requests described on this weblog put up.

Checking if a Utilization Meter occasion is registered

Earlier than registering a Utilization Meter, examine if it has already been registered with Utilization Perception.

Right here is the best way to do it:

  1. Execute the next GET registration request:

  • Use the UUID of your Utilization Meter.
  • Use the generated entry token to authenticate to the service.
  1. In case your registration is profitable, you’ll get the next response: Standing 200 OK, additionally a contract quantity, and a web site title. See the screenshot beneath:

Pattern cURL Code

Notice: Exchange the Utilization Meter UUID with your personal. Yow will discover it in your Utilization Meter internet software, beneath the About tab. Use the entry token you generated for the authorization.

Registering a Utilization Meter within the Commerce Portal

To register your Utilization Meter with a contract within the Commerce Portal utilizing the brand new REST API, you’ll need to authenticate with the Utilization Perception service to which to ship the registration request.

Listed below are the precise steps:

  1. Ship POST request to the Utilization Perception service, which is able to deal with the registration of the Utilization Meter occasion with a contract within the Commerce Portal.

  1. Within the physique of the request, you could specify the next:

  1. For the authorization with the Utilization Perception service, use the generated entry token.
  1. Execute the request. If the Utilization Meter registration is profitable, then you’ll get code 202. See an instance beneath:

If this Utilization Meter has already been registered, you’ll get code 201.

  1. Go to the VMware Commerce portal to confirm if Utilization Meter is registered with the desired contract and org web site.

Pattern cURL code

Notice: Use your Utilization Meter particulars an present the entry token you generated from the CPN refresh token.

Getting Data on All Utilization Studies

Utilization report API is now dully documented and is able to be applied in your group. Listed below are the API requests that you need to use to automate your utilization report technology:

  • Get info on all utilization studies for a selected month and yr for a company
  • Obtain a selected utilization report by specifying its reference quantity retrieved from the get info on all utilization studies API request
  • Lastly, get info on all studies related by a utilization meter UUID

Get Data on All Utilization Studies for a Month

To get info on all utilization studies of all Utilization Meters in your CPN group for a selected month and yr, do the next:

  1. Execute GET https://ums.vmware.com/utilization/api/v1/studies/2023/1 request to the Utilization Perception service endpoint.
  2. Present the month and yr for which you want to get all utilization studies for all of your registered Utilization Meters.
  3. Authenticate to Utilization Perception with the generated entry token.
  4. In case your request is profitable, you’ll get Standing 200 OK and an inventory of all utilization studies related to Utilization Meter UUID. Right here is an instance of the response.

Pattern cURL code

Notice: Specify a month and a yr for which to get info on all utilization studies of a CPN group.

Obtain a Particular Utilization Report

To obtain a selected Utilization Meter report, you want to present within the parameters of your API request the reference variety of that report. To search out it, you want first to set off GET info on all utilization studies request. See the Getting Data on All Utilization Studies for a Month part.

Right here is the best way to obtain a selected Utilization Meter report:

1. Make a GET request to https://ums.vmware.com/utilization/api/v1/studies and specify the next:

  • Within the parameters of the request enter the reference variety of the report. This worth you could retrieve from the request defined within the Get Data on All Studies for a Month part.
  • Within the header of the request, you could specify the Settle for parameter to be the content material sort of the report (once more get this info from the get info on all utilization studies API request)
  • Authenticate to the Utilization Perception service through the use of the generated entry code.
  1. The response will probably be Standing 200 OK if the request is profitable, and also you additionally get the textual content of the zipped report. On this instance, the response is just not decoded as Postman does node decode the content material of zipped recordsdata.
  1. Save the response.  In Postman, the best way to do it’s to click on Save Response. This manner you’ll obtain the referenced report.

Pattern cURL code

Notice: Use the reference variety of the report you want to obtain the your generated entry token.

Get Data on all Studies of a Utilization Meter Occasion

To get info on all utilization studies of a selected Utilization Meters, do the next:

  1. Execute a GET request to the Utilization Perception service, specifying the month and yr for which you want to get info and the uuid of the utilization meter with which the studies are related.
  1. Present the generated entry token with which to authenticate with the Utilization Perception service.
  1. You’ll get the next response: Standing 200 OK and the small print of all studies associated to this Utilization Meter and their reference numbers.

Notice: Use the reference variety of the studies you want to obtain with the GET / https://ums.vmware.com/utilization/api/v1/studies API request.

Right here is an instance of the request and its response.

Pattern cURL Code

Notice: Specify a month and a yr for which to get info on all utilization studies related to the uuid of your utilization meter. Exchange the Utilization Meter UUID on this instance with your personal.

Conclusion

In a conclusion, you need to use these APIs as a part of your Utilization Meter reporting automation.  Now with the registration of the Utilization Meter occasion you’ll be able to totally automate the set up and configuration of your Utilization Meter cases.

We’ll maintain enhancing and increasing our Utilization Meter-related APIs and wish to hear from you about what different APIs we are able to develop to enhance your reporting expertise.

The remainder of the Utilization Meter API requests might be discovered right here. Cloud Accomplice Navigator and Commerce Portal APIs might be discovered right here and right here.

For extra questions or queries, depart a remark beneath or ship us an e mail to usagemeter@vmware.com. There’s a Slack channel accessible to cloud suppliers the place you can even ask your questions.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments