Projects API Code Samples
Selection of code samples that demonstrate the use of the Projects 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 "Projects" in API Reference.
Retrieve a list of draft projects accessible to the user
Use this sample request to retrieve all the draft projects that you can access in Visier.
Note: For administrating tenants, this sample retrieves draft projects from the administrating tenant.
If you don't specify a tenant, the default is the administrating tenant. If you specify the TargetTenantID in the request header, the request applies to the target tenant.
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1beta/admin/projects' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'
The following sample request specifies the analytic tenant WFF_j1r~c7o in the request header to retrieve draft projects that you user can access in the analytic tenant.
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1beta/admin/projects' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'TargetTenantID:WFF_j1r~c7o'
The response returns the details of all draft projects that your user can access.
{
"openProjects": [
{
"id": "8b132f3c-8074-4663-a971-a1b62cab4007",
"name": "Sample Project 1",
"capabilities": [
"owner"
]
},
{
"id": "df68e790-8ce1-4950-9d87-99915ccb4d48",
"name": "Sample Project 2",
"capabilities": [
"owner"
]
}
]
}
Retrieve a draft project's information
Use this sample request to retrieve the details of a specific draft project.
Note: For administrating tenants, this sample retrieves a project from the administrating tenant.
If you don't specify a tenant, the default is the administrating tenant. If you specify the TargetTenantID in the request header, the request applies to the target tenant.
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1beta/admin/projects/8b132f3c-8074-4663-a971-a1b62cab4007' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'
The following sample request specifies the analytic tenant WFF_j1r~c7o in the request header to retrieve a draft project from the analytic tenant.
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1beta/admin/projects/8b132f3c-8074-4663-a971-a1b62cab4007' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'TargetTenantID:WFF_j1r~c7o'
The response returns the details of the requested project.
{
"id": "8b132f3c-8074-4663-a971-a1b62cab4007",
"name": "Sample Project 1",
"capabilities": [
"owner"
]
}
Retrieve a list of all committed changes in a project
Use this sample to retrieve the committed changes in a specific project.
curl GET --url 'https://{vanity_name}.api.visier.io/v1beta/admin/projects/8b132f3c-8074-4663-a971-a1b62cab4007/commits' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'
The response returns the committed changes.
{
"commits": [
{
"id": "9bdeae7e-66b2-45b3-87b0-2e80f403c9c3",
"name": "Map badge swipes",
"description": "Map badge swipe data to analytic object"
},
{
"id": "7977008f-5e8a-4134-a7fb-887d0b0dba99",
"name": "Map PTO and sick days",
"description": "Map vacation and sick day data to absence analytic object"
}
]
}
Create a new draft project
Use this sample request to create a new project.
curl -X POST --url 'https://{vanity_name}.api.visier.io/v1beta/admin/projects' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-d '{
"name": "Sample Project 3",
"description": "This is a sample project",
"releaseVersion": "1",
"ticketNumber": "12345",
"versionNumber": 1005
}'
The response returns the details of the created project.
{
"id": "5a031f08-5895-4e54-9333-32de249f2e5a",
"name": "Sample Project 3",
"description": "This is a sample project",
"releaseVersion": "1",
"ticketNumber": "12345",
"versionNumber": 1005,
"capabilities": [
"owner"
]
}
Perform an operation on a draft project
Use this sample publish a project to production.
Note: For administrating tenants, this sample publishes a project in the administrating tenant.
If you don't specify a tenant, the default is the administrating tenant. If you specify the TargetTenantID in the request header, the request applies to the target tenant.
curl -X POST --url 'https://{vanity_name}.api.visier.io/v1beta/admin/projects/5a031f08-5895-4e54-9333-32de249f2e5a' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-d '{
"operation": "commitAndPublish"
}'
The following sample request specifies the analytic tenant WFF_j1r~c7o in the request header to publish a project in.
curl -X POST --url 'https://{vanity_name}.api.visier.io/v1beta/admin/projects/5a031f08-5895-4e54-9333-32de249f2e5a' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'TargetTenantID:WFF_j1r~c7o' \
-d '{
"operation": "commitAndPublish"
}'
The response returns the results of the API request.
{
"commitAndPublish": {
"publishedVersion": {
"id": "5a031f08-5895-4e54-9333-32de249f2e5a",
"name": "Published project through the Projects API: 6-20240716."
}
}
}
Delete a draft project
Use this sample request to delete an existing draft project.
Note: For administrating tenants, this sample deletes a project in the administrating tenant.
If you don't specify a tenant, the default is the administrating tenant. If you specify the TargetTenantID in the request header, the request applies to the target tenant.
curl -X DELETE --url 'https://{vanity_name}.api.visier.io/v1beta/admin/projects/8b132f3c-8074-4663-a971-a1b62cab4007' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'
The following sample request specifies the analytic tenant WFF_j1r~c7o in the request header to delete a project in.
curl -X DELETE --url 'https://{vanity_name}.api.visier.io/v1beta/admin/projects8b132f3c-8074-4663-a971-a1b62cab4007' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'TargetTenantID:WFF_j1r~c7o'
The response returns the results of the API request.
{
"id": "8b132f3c-8074-4663-a971-a1b62cab4007",
"name": "Sample Project 1"
}
Import committed changes into a project
Use this sample to import a ZIP file that contains a list of committed changes into a draft project.
curl --location --request PUT 'https://{vanity_name}.api.visier.io/v1beta/admin/projects/94ac1d7d-6033-4860-bae5-4531253b4c3e/commits' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'Content-Type: application/zip' \
-d '@{committed_changes_export_file_path}'
The response returns the changes that were imported to the project.
{
"commits": [
{
"id": "94ac1d7d-6033-4860-bae5-4531253b4c3e",
"name": "Talent acquisition module implementation",
"description": "Implement a TA module as a SKU that we can offer to customers.",
"versionNumber": 39
},
{
"id": "0cdd5265-d54f-4559-aabb-9980d31c7256",
"name": "Map requisition source data",
"description": "Map source data for requisitions to the corresponding analytic objects.",
"versionNumber": 38
}
]
}