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.
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1alpha/admin/projects' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'
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.
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 response returns the details of the requested project.
{
"id": "8b132f3c-8074-4663-a971-a1b62cab4007",
"name": "Sample Project 1",
"capabilities": [
"owner"
]
}
Create a new draft project
Use this sample request to create a new 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 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.
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 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.
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 response returns the results of the API request.
{
"id": "8b132f3c-8074-4663-a971-a1b62cab4007",
"name": "Sample Project 1"
}