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 in tenant WFF_j1r~c7o
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1/data/model/metrics' \
-H 'apikey:{api_key}'
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'TargetTenantID:WFF_j1r~c7o'

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 in tenant WFF_j1r~c7o
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1/data/model/currencies' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'TargetTenantID:WFF_j1r~c7o'

Retrieve a currency

This sample request retrieves information for the USD currency.

Copy
cURL sample request: Retrieve a specific currency in tenant WFF_j1r~c7o
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1/data/model/currencies/USD' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'TargetTenantID:WFF_j1r~c7o'

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 in tenant WFF_j1r~c7o
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}' \
-H 'TargetTenantID:WFF_j1r~c7o'

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 in tenant WFF_j1r~c7o
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}' \
-H 'TargetTenantID:WFF_j1r~c7o'

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 in tenants WFF_j1r~c1o and WFF_j1r~c2o
curl -X PATCH --url 'https://{vanity_name}.api.visier.io/v1/data/model/properties' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'Content-Type: application/json' \
-d '{
    "propertiesByTenant": [
        {
            "tenantCode": "WFF_j1r~c1o",
            "projectId": "da808a8e-76e1-4094-a288-5e2755388bbd",
            "properties": [
                {
                    "id": "Employee.Birth_Date",
                    "displayName": "New Birth Date",
                    "shortDisplayName": "Birthday",
                    "description": "Day employee was born"
                }
            ]
        },
        {
            "tenantCode": "WFF_j1r~c2o",
            "properties": [
                {
                    "id": "Employee.Birth_Date",
                    "displayName": "Very New Birth Date",
                    "shortDisplayName": "Birth Day",
                    "description": "The Employee''s birthday"
                }
            ]
        }
    ]
}'

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 in tenant WFF_j1r~c1o
curl -X PATCH --url 'https://{vanity_name}.api.visier.io/v1/data/model/dimensions' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'Content-Type: application/json' \
-d '{
    "dimensionsByTenant": [
        {
            "tenantCode": "WFF_j1r~c1o",
            "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.

Update analytic objects

Note: Alpha This API is in alpha. While in alpha, APIs may change in a breaking way without notice; functionality may be removed, and no deprecation notices will be issued. If you are interested in using this API, please contact your Partner Success Manager (PSM).

This sample request reverts analytic objects to Blueprint in two tenants and two projects. To publish the update to production immediately, omit the projectId parameter.

Copy
cURL sample request: Revert Employee and 2e560736-8f26-4a2b-9b00-15cc0fc154fa to Blueprint in tenants WFF_b4p and WFF_j1r~c7o
curl -X PUT --url 'https://{vanity_name}.api.visier.io/v2alpha/data/model/analytic-objects' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'Content-Type: application/json' \
-d '{
    "analyticObjects": [
        {
            "executionContext": {
                "tenantCode": "WFF_b4p",
                "projectId": "da808a8e-76e1-4094-a288-5e2755388bbd"
            },
            "analyticObject": {
                "objectName": "Employee",
                "updateOperation": "revertToBP"
            }
        },
        {
            "executionContext": {
                "tenantCode": "WFF_j1r~c1o",
                "projectId": "eb808a8e-78e1-4594-a298-5e5755388bec",
            },
            "analyticObject": {
                "uuid": "2e560736-8f26-4a2b-9b00-15cc0fc154fa",
                "updateOperation": "revertToBP"
            }
        }
    ]
}'

The response returns the successful or unsuccessful object updates.