CredHub has two API endpoints to identify and reuse variables. To see all the credentials associated with your product, or you want to troubleshoot problems specific to one virtual machine (VM), you can use these APIs for those purposes.

The API endpoints perform these functions:

  • Identifying and printing the name of a variable.
  • Using the name of the variable to identify and print the value of the variable.

Using the API endpoints

You can Use endpoints to view variables for any product in Tanzu Operations Manager, except the BOSH Director. These endpoints are read-only. You cannot use them to add, remove, or rotate variables.

Fetching Variables

This endpoint returns the list of variables associated with a product that are stored in CredHub. Not all variables are stored in CredHub. If you call a variable that is not stored in CredHub, the call returns an empty value.

$ curl "https://OPS-MAN-FQDN/api/variables"
    -X GET \
    -H "Authorization: Bearer EXAMPLE_UAA_ACCESS_TOKEN"

Response example

HTTP/1.1 200 OK

{
  "variables": ["FIRST-EXAMPLE-VARIABLE", "SECOND-EXAMPLE-VARIABLE", "THIRD-EXAMPLE-VARIABLE"]
}

Query parameters

Parameter Description
product_guid The unique product identifier, formatted as a text string

This endpoint returns the name of the variable. Use the name in the next endpoint to return the variable value.

Fetching variable values

This endpoint returns the value of a variable stored in CredHub. Not all variables are stored in CredHub, because if you call a variable that is not in CredHub, the call returns an empty value.

$ curl "https://OPS-MAN-FQDN/api/variables" name=EXAMPLE-VARIABLE-NAME" \
    -X GET \
    -H "Authorization: Bearer UAA_ACCESS_TOKEN"

Example Response

HTTP/1.1 200 OK

{
  "credhub-password": "EXAMPLE-PASSWORD"
}

Query Parameters

Parameter Description
variable_name The name of the variable, formatted as a text string
product_guid The unique product identifier, formatted as a text string
check-circle-line exclamation-circle-line close-line
Scroll to top icon