Tenants API Code Samples

Selection of code samples that demonstrate the use of the Tenants 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 "Tenants" in API Reference.

Retrieve a list of all tenants

Note: This endpoint is available in v1 and v2. The sample code is for v2 (the recommended version).

Use this sample request to retrieve all the tenants that you manage.

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

The response returns details about each analytic tenant.

Retrieve an analytic tenant's details

Note: This endpoint is available in v1 and v2. The sample code is for v2 (the recommended version).

Use this sample request to retrieve information about a specified tenant.

Copy
cURL sample request: Retrieve the detail's of a specific tenant
curl -X GET --url 'https://{vanity_name}.api.visier.io/v2/admin/tenants/WFF_j1r~i1o' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'
-H 'Content-Type: application/json' \
-d '{ "mask": "industryCode,homeAnalysisId,homeAnalysisByUserGroup" }'

The response returns the requested details about the tenant, including the industryCode, homeAnalysisId, and homeAnalysisByUserGroup.

Add an analytic tenant

Note: This endpoint is available in v1 and v2. The sample code is for v2 (the recommended version).

Use this sample request to create a new tenant.

Copy
cURL sample request: Add an analytic tenant
curl -X POST --url 'https://{vanity_name}.api.visier.io/v2/admin/tenants' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'
-H 'Content-Type: application/json' \
-d '{
    "tenantCode": "i1o",
    "tenantDisplayName": "Radical Solutions",
    "industryCode": 554422,
    "purchasedModules": [ "Organization" ],
    "embeddableDomains": [ "https://url1.jupiter.com","https://url2.jupiter.com" ],
    "customProperties": [
        { "key": "tier", "value":"premier" },
        { "key": "schedule", "value": "biweekly" }
    ],
    "ssoInstanceIssuers": [ "myIssuer" ],
    "homeAnalysisId": "66-22-99-00",
    "homeAnalysisByUserGroup": [
        { "userGroupId": "11-22-33-44", "homeAnalysisId": "55-66-77-88" },
        { "userGroupId": "99-88-77-66", "homeAnalysisId": "55-44-33-22" }
    ]
}'

The response returns details about the newly created tenant.

Update an analytic tenant

Note: This endpoint is available in v1 and v2. The sample code is for v2 (the recommended version).

Use this sample request to update an existing tenant.

Copy
cURL sample request: Update an analytic tenant
curl -X PUT --url 'https://{vanity_name}.api.visier.io/v2/admin/tenants/WFF_j1r~i1o' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'
-H 'Content-Type: application/json' \
 -d '{
    "tenantDisplayName": "Radical Solutions",
    "industryCode": 554422,
    "embeddableDomains": [ "https://url1.jupiter.com","https://url2.jupiter.com" ],
    "customProperties": [
        { "key": "tier", "value":"premier" },
        { "key": "schedule", "value": "biweekly" }
    ],
    "ssoInstanceIssuers": [ "myIssuer" ],
    "homeAnalysisId": "66-22-99-00",
    "homeAnalysisByUserGroup": [
        { "userGroupId": "11-22-33-44", "homeAnalysisId": "55-66-77-88" },
        { "userGroupId": "99-88-77-66", "homeAnalysisId": "55-44-33-22" }
    ],
    "updateAction": "REPLACE"
}'

The response returns the fields that were updated.

Enable an analytic tenant

Note: If you use v2, you can enable a tenant with the PUT v2/admin/tenants/{tenantCode} endpoint.

Use this sample request to enable an existing tenant.

Copy
cURL sample request: Enable an analytic tenant
curl -X PUT --url 'https://{vanity_name}.api.visier.io/v1/admin/tenants/WFF_j1r~i1o/enable' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'

The response returns whether the tenant was successfully enabled or not.

Disable an analytic tenant

Note: If you use v2, you can disable a tenant with the PUT v2/admin/tenants/{tenantCode} endpoint.

Use this sample request to disable an existing tenant.

Copy
cURL sample request: Disable an analytic tenant
curl -X PUT --url 'https://{vanity_name}.api.visier.io/v1/admin/tenants/WFF_j1r~i1o/disable' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'

The response returns whether the tenant was successfully disabled or not.

Deprovision an analytic tenant

Note:  

  • You must disable an analytic tenant before you deprovision it.
  • Deprovisioning (or deleting) an analytic tenant is not reversible.

Use this sample request to deprovision a disabled tenant.

Copy
cURL sample request: Deprovision analytic tenant
curl -X DELETE --url 'https://{vanity_name}.api.visier.io/v1/admin/tenants/WFF_j1r~i1o' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'

The response returns whether the tenant was successfully deprovisioned or not.

Validate metric values for all analytic tenants

Use this sample request to retrieve the metric values for all analytic tenants.

Copy
cURL sample request: Retrieve the metric values of all tenants
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1/op/validation/tenants' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'

The response returns the metric values for each tenant.

Validate metric values for an analytic tenant

Use this sample request to retrieve the metric values for a specified analytic tenant.

Copy
cURL sample request: Retrieve the metric values of a specified analytic tenant
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1/op/validation/tenants/WFF_j1r~i1o' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'

The response returns the metric values for the tenant.