top of page
Brock Peterson

Edit Credentials via Aria Operations SaaS API

We discussed the Aria Operations SaaS API previously here, detailing how to get a Cloud Services Portal (CSP) API Token, use that token to get an API Auth Token, and subsequently make calls to API endpoints.


As a quick refresher, to get your CSP API Token, go to My Account - API Tokens - GENERATE A NEW API TOKEN and generate a new token.



I've created a non-expiring CSP API Token with All Roles, which I will subsequently exchange for an API Auth Token via the following (substituting the previously generated CSP API Token):

curl -k -X POST "https://console.cloud.vmware.com/csp/gateway/am/api/auth/api-tokens/authorize" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "refresh_token=csp_api_token_goes_here”

Output of this command will be as follows:

         { "id_token", "token_type", "expires_in", "scope", "access_token", "refresh_token” }

The access_token is your API Auth Token to be used to access the Aria Operations SaaS API, which is good for 30 minutes. Let's run the GET /api/credentials to get all credentials, the command will look like this:

curl -X GET "https://www.mgmt.cloud.vmware.com/vrops-cloud/suite-api/api/credentials?_no_links=true" -H  "accept: application/json" -H  "Authorization: CSPToken access_token_goes_here"

The output will list all Credentials, each with an "id" that we'll use to make adjustments to the associated password. Find the Credential you'd like to change, adjust the id field of your call, add the value of your new password and run it. Your call should look something like this:

curl -X PUT "https://www.mgmt.cloud.vmware.com/vrops-cloud/suite-api/api/credentials?_no_links=true" -H  "accept: application/json" -H  "Content-Type: application/json" -H  "Authorization: CSPToken access_token_goes_here" -d "{  \"id\" : \"474c304a-f7b8-444d-a001-3d6af824eba5\",  \"name\": \"Cisco UCS Central Credentials v2\",      \"adapterKindKey\": \"CiscoUcsAdapter\",      \"credentialKindKey\": \"bm_cisco_ucs_credentials_new\",      \"fields\": [        {          \"name\": \"username\",          \"value\": \"bluem\"        },        {          \"name\": \"password\",          \"value\": \"new_password_goes_here\"        }      ],      \"editable\": true    }"

All of this can be done via Postman, a script calling cURL, the Swagger API, etc. I prefer the Swagger API just so I can test calls, visualize the output, etc. Here are the Swagger API calls to get my credential and adjust it's password.



Aria Operations SaaS API is powerful, use it!

Comments


bottom of page