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.

Copy
cURL sample request: Retrieve a list of all projects
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1alpha/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.

Copy
cURL sample request: Retrieve a list of all projects in an analytic tenant
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1alpha/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.

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.

Copy
cURL sample request: Retrieve a project's details
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1alpha/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.

Copy
cURL sample request: Retrieve the details of a project in an analytic tenant
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1alpha/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.

Retrieve a list of all committed changes in a project

Use this sample to retrieve the committed changes in a specific project.

Copy
cURL sample request: Retrieve a list of all committed changes in the 8b132f3c-8074-4663-a971-a1b62cab4007 project
curl GET --url 'https://{vanity_name}.api.visier.io/v1alpha/admin/projects/8b132f3c-8074-4663-a971-a1b62cab4007/commits' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'

The response returns the committed changes.

Create a new draft project

Use this sample request to create a new project.

Note: For administrating tenants, this sample creates 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.

Copy
cURL sample request: Create a project
curl -X POST --url 'https://{vanity_name}.api.visier.io/v1alpha/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 following sample request specifies the analytic tenant WFF_j1r~c7o in the request header to create a project in.

Copy
cURL sample request: Create a project in WFF_j1r~c7o
curl -X POST --url 'https://{vanity_name}.api.visier.io/v1alpha/admin/projects' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'TargetTenantID:WFF_j1r~c7o' \
-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.

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.

Copy
cURL sample request: Publish a project
curl -X POST --url 'https://{vanity_name}.api.visier.io/v1alpha/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.

Copy
cURL sample request: Publish a project in WFF_j1r~c7o
curl -X POST --url 'https://{vanity_name}.api.visier.io/v1alpha/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.

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.

Copy
cURL sample request: Delete a project
curl -X DELETE --url 'https://{vanity_name}.api.visier.io/v1alpha/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.

Copy
cURL sample request: Delete a project in WFF_j1r~c7o
curl -X DELETE --url 'https://{vanity_name}.api.visier.io/v1alpha/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.

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.

Copy
cURL sample request: Import committed changes into project 94ac1d7d-6033-4860-bae5-4531253b4c3e
curl --location --request PUT 'https://{vanity_name}.api.visier.io/v1alpha/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.