Data Model API Code Samples

Selection of code samples that demonstrate the use of the Data Model API. Copy and edit these code samples to suit your needs.

When using the code samples, remember to replace:

  • {vanity_name} with your tenant name
  • {api_key} with your API key
  • {security_token} with a valid security token

These code samples may not include all available parameters and request body fields for each endpoint. For the endpoint's full request schema, see "Data Model" in API Reference.

Note: Each data model is unique to each Visier tenant, depending on purchased applications and any custom objects. The objects in the response are retrieved from the tenant specified by the tenant name in the request.

Retrieve a list of metrics

This sample request retrieves information about all the metrics in your Visier solution.

Copy
cURL sample request: Retrieve a list of metrics
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1/data/model/metrics' \
-H 'apikey:{api_key}'
-H 'Cookie:VisierASIDToken={security_token}'

Retrieve all currencies

This sample request retrieves information about all currencies in your Visier solution.

Copy

cURL sample request: Retrieve a list of all currencies

curl -X GET --url 'https://{vanity_name}.api.visier.io/v1/data/model/currencies' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'

Retrieve a currency

This sample request retrieves information for the USD currency.

Copy

cURL sample request: Retrieve a specific currency

curl -X GET --url 'https://{vanity_name}.api.visier.io/v1/data/model/currencies/USD' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'

Retrieve all exchange rates for a currency

This sample request retrieves all the available exchange rates for USD currency for a specific time period.

Copy

cURL sample request: Retrieve all exchange rates for a currency

curl -X GET --url 'https://{vanity_name}.api.visier.io/v1/data/model/currencies/USD/rates?startTime=1677628800000&endTime=1680546444000' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'

Retrieve exchange rates from one currency to another currency

This sample request retrieves all the available exchange rates from CAD to USD for a specific time period.

Copy

cURL sample request: Retrieve exchange rates from one currency to another currency

curl -X GET --url 'https://{vanity_name}.api.visier.io/v1/data/model/currencies/CAD/rates/USD?startTime=1677626600000&endTime=1680546444000' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'

Update properties

This sample request updates the display name, short display name, and description of a property in a project. To publish the update to production immediately, omit the projectId parameter.

Copy
cURL sample request: Update properties
curl -X PATCH --url 'https://{vanity_name}.api.visier.io/v1/data/model/properties' \
-H 'Content-Type: application/json' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-d '{
      "propertiesByTenant": [
        {
          "projectId": "da808a8e-76e1-4094-a288-5e2755388bbd",
          "properties": [
            {
              "id": "Employee.Birth_Date",
              "displayName": "New Birth Date",
              "shortDisplayName": "Birthday",
              "description": "Day employee was born"
            }
          ]
        }
      ]
    }'

The response returns the successful or unsuccessful property updates.

Update dimensions

This sample request updates the display name, short display name, and description of a dimension in a project. To publish the update to production immediately, omit the projectId parameter.

Copy
cURL sample request: Update dimensions
curl -X PATCH --url 'https://{vanity_name}.api.visier.io/v1/data/model/dimensions' \
-H 'Content-Type: application/json' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-d '{
      "dimensionsByTenant": [
        {
          "projectId": "da808a8e-76e1-4094-a288-5e2755388bbd",
          "dimensions": [
            {
              "id": "Employee.Vaccination_Status",
              "displayName": "COVID-19 Vaccine Status",
              "shortDisplayName": "COVID Vacc",
              "description": "Employee has received one or more dose of COVID-19 vaccine"
            }
          ]
        }
      ]
    }'

The response returns the successful or unsuccessful dimension updates.