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.
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.
{
"tenants": [
{
"tenantCode": "WFF_j1r~i1o",
"tenantDisplayName": "io",
"enabled": "true",
"provisionDate": "2021-12-03T22:31:55.938Z",
"currentDataVersion": "7000007",
"dataVersionDate": "2022-12-14T19:06:02.079Z",
"purchasedModules": [ "Talent_Acquisition", "Organization" ],
"industryCode": 55422,
"canAdministerOtherTenants": false,
"embeddableDomains": [ "https://url1.jupiter.com", "https://url2.jupiter.com" ],
"customProperties": [
{ "key": "tier", "value":"premier" },
{ "key": "schedule": "biweekly" }
],
"ssoInstanceIssuers": [ "myissuer" ],
"vanityUrlName": "jupiter",
"homeAnalysisId": "11-22-33-44",
"homeAnalysisByUserGroup": [
{ "userGroupId": "22-33-44-55", "homeAnalysisId": "33-44-55-66" }
]
}, {
"tenantCode": "WFF_j1r~c3d",
"tenantDisplayName": "cd",
"enabled": "true",
"provisionDate": "2021-12-03T22:31:55.938Z",
"currentDataVersion": "7000007",
"dataVersionDate": "2022-12-14T19:06:02.079Z",
"purchasedModules": [ "Talent_Acquisition", "Organization" ],
"industryCode": 123456,
"canAdministerOtherTenants": false,
"embeddableDomains": [ "https://url3.jupiter.com", "https://url4.jupiter.com" ],
"customProperties": [
{ "key": "tier", "value": "base" },
{ "key": "schedule", "value": "monthly" }
],
"ssoInstanceIssuers": [],
"vanityUrlName": "jupiter",
"homeAnalysisId": "44-55-66-77",
"homeAnalysisByUserGroup": [
{ "userGroupId": "55-66-77-88", "homeAnalysisId": "66-77-88-99" }
]
}
]
}
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.
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.
{
"tenantCode": "i1o",
"industryCode": 554422,
"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" }
]
}
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.
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.
{
"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" }
]
}
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.
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.
{
"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" }
]
}
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.
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.
{
"tenantCode": "WFF_j1r~i1o",
"status": "Enabled",
"tenantDisplayName": "Io"
}
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.
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.
{
"tenantCode": "WFF_j1r~i1o",
"status": "Disabled",
"tenantDisplayName": "Io"
}
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.
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.
{
"tenantCode": "WFF_j1r~i1o",
"status": "Deprovisioned",
"tenantDisplayName": "Io"
}
Validate metric values for all analytic tenants
Use this sample request to retrieve the metric values for all analytic 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.
{
"tenants": [{
"tenantCode": "WFF_j1r~c7o",
"dataVersion": "7000003",
"dataVersionDate": "2019-10-02T20:35:21.420Z",
"metrics": [{
"symbolName": "employeeCount",
"displayName": "Headcount",
"value": 220.0
}, {
"symbolName": "Starts",
"displayName": "Employee Starts Count",
"value": 154.0
}, {
"symbolName": "Exit",
"displayName": "Exit Count",
"value": 35.0
}, {
"symbolName": "Turnover",
"displayName": "Turnover Count",
"value": 97.0
}, {
"symbolName": "Total_Cost_of_Workforce_Root",
"displayName": "Actual Total Cost of Workforce",
"value": 2959329.43
}]
}, {
"tenantCode": "WFF_j1r~e1a",
"dataVersion": "7000110",
"dataVersionDate": "2019-10-01T20:30:22.320Z",
"metrics": [{
"symbolName": "employeeCount",
"displayName": "Headcount",
"value": 451.0
}, {
"symbolName": "Starts",
"displayName": "Employee Starts Count",
"value": 340.0
}, {
"symbolName": "Exit",
"displayName": "Exit Count",
"value": 174.0
}, {
"symbolName": "Turnover",
"displayName": "Turnover Count",
"value": 152.0
}, {
"symbolName": "Total_Cost_of_Workforce_Root",
"displayName": "Actual Total Cost of Workforce",
"value": 3212356632.72
}]
}]
}
Validate metric values for an analytic tenant
Use this sample request to retrieve the metric values for 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.
{
"tenantCode": "WFF_j1r~i1o",
"dataVersion": "7000003",
"dataVersionDate": "2019-10-02T20:35:21.420Z",
"metrics": [{
"symbolName": "employeeCount",
"displayName": "Headcount",
"value": 220.0
}, {
"symbolName": "Starts",
"displayName": "Employee Starts Count",
"value": 154.0
}, {
"symbolName": "Exit",
"displayName": "Exit Count",
"value": 35.0
}, {
"symbolName": "Turnover",
"displayName": "Turnover Count",
"value": 97.0
}, {
"symbolName": "Total_Cost_of_Workforce_Root",
"displayName": "Actual Total Cost of Workforce",
"value": 2959329.43
}]
}