Collection
Create a collection
Org ID
Requested API version
2021-06-04
Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$
Returned collection
Bad Request: A parameter provided as a part of the request was invalid.
Unauthorized: the request requires an authentication token.
Forbidden: the request requires an authentication token with more or different permissions.
Not Found: The resource being operated on could not be found.
Conflict: The requested operation conflicts with the current state of the resource in some way.
Internal Server Error: An error was encountered while attempting to process the request.
POST /rest/orgs/{org_id}/collections HTTP/1.1
Host: api.snyk.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 57
{
"data": {
"attributes": {
"name": "text"
},
"type": "resource"
}
}
{
"data": {
"attributes": {
"is_generated": true,
"name": "text"
},
"id": "123e4567-e89b-12d3-a456-426614174000",
"relationships": {
"created_by_user": {
"data": {
"id": "331ede0a-de94-456f-b788-166caeca58bf",
"type": "user"
}
},
"org": {
"data": {
"id": "331ede0a-de94-456f-b788-166caeca58bf",
"type": "org"
}
}
},
"type": "resource"
},
"jsonapi": {
"version": "1.0"
},
"links": {
"self": "https://example.com/api/this_resource"
}
}
Return a list of organization's collections with issues counts and projects count.
Org ID
Requested API version
2021-06-04
Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$
Return the page of results immediately after this cursor
v1.eyJpZCI6IjEwMDAifQo=
Return the page of results immediately before this cursor
v1.eyJpZCI6IjExMDAifQo=
Number of results to return per page
10
Example: 10
Return collections sorted by the specified attributes
Return collections sorted in the specified direction
DESC
Possible values: Return collections which names include the provided string
Return collections where is_generated matches the provided boolean
Returns a list of collections
Bad Request: A parameter provided as a part of the request was invalid.
Unauthorized: the request requires an authentication token.
Forbidden: the request requires an authentication token with more or different permissions.
Not Found: The resource being operated on could not be found.
Internal Server Error: An error was encountered while attempting to process the request.
GET /rest/orgs/{org_id}/collections HTTP/1.1
Host: api.snyk.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"data": [
{
"attributes": {
"is_generated": true,
"name": "text"
},
"id": "123e4567-e89b-12d3-a456-426614174000",
"meta": {
"issues_critical_count": 10,
"issues_high_count": 10,
"issues_low_count": 10,
"issues_medium_count": 10,
"projects_count": 7
},
"relationships": {
"created_by_user": {
"data": {
"id": "331ede0a-de94-456f-b788-166caeca58bf",
"type": "user"
}
},
"org": {
"data": {
"id": "331ede0a-de94-456f-b788-166caeca58bf",
"type": "org"
}
}
},
"type": "resource"
}
],
"jsonapi": {
"version": "1.0"
},
"links": {
"first": "https://example.com/api/resource?ending_before=v1.eyJpZCI6IjExIn0K",
"last": "https://example.com/api/resource?starting_after=v1.eyJpZCI6IjMwIn0K",
"next": "https://example.com/api/resource?starting_after=v1.eyJpZCI6IjEwIn0K"
}
}
Edit a collection
Org ID
Unique identifier for a collection
Requested API version
2021-06-04
Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$
Returned collection
Bad Request: A parameter provided as a part of the request was invalid.
Unauthorized: the request requires an authentication token.
Forbidden: the request requires an authentication token with more or different permissions.
Not Found: The resource being operated on could not be found.
Conflict: The requested operation conflicts with the current state of the resource in some way.
Internal Server Error: An error was encountered while attempting to process the request.
PATCH /rest/orgs/{org_id}/collections/{collection_id} HTTP/1.1
Host: api.snyk.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 101
{
"data": {
"attributes": {
"name": "text"
},
"id": "123e4567-e89b-12d3-a456-426614174000",
"type": "resource"
}
}
{
"data": {
"attributes": {
"is_generated": true,
"name": "text"
},
"id": "123e4567-e89b-12d3-a456-426614174000",
"relationships": {
"created_by_user": {
"data": {
"id": "331ede0a-de94-456f-b788-166caeca58bf",
"type": "user"
}
},
"org": {
"data": {
"id": "331ede0a-de94-456f-b788-166caeca58bf",
"type": "org"
}
}
},
"type": "resource"
},
"jsonapi": {
"version": "1.0"
},
"links": {
"self": "https://example.com/api/this_resource"
}
}
Get a collection
Org ID
Unique identifier for a collection
Requested API version
2021-06-04
Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$
Returned collection
Bad Request: A parameter provided as a part of the request was invalid.
Unauthorized: the request requires an authentication token.
Forbidden: the request requires an authentication token with more or different permissions.
Not Found: The resource being operated on could not be found.
Conflict: The requested operation conflicts with the current state of the resource in some way.
Internal Server Error: An error was encountered while attempting to process the request.
GET /rest/orgs/{org_id}/collections/{collection_id} HTTP/1.1
Host: api.snyk.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"data": {
"attributes": {
"is_generated": true,
"name": "text"
},
"id": "123e4567-e89b-12d3-a456-426614174000",
"relationships": {
"created_by_user": {
"data": {
"id": "331ede0a-de94-456f-b788-166caeca58bf",
"type": "user"
}
},
"org": {
"data": {
"id": "331ede0a-de94-456f-b788-166caeca58bf",
"type": "org"
}
}
},
"type": "resource"
},
"jsonapi": {
"version": "1.0"
},
"links": {
"self": "https://example.com/api/this_resource"
}
}
Delete a collection
Org ID
Unique identifier for a collection
Requested API version
2021-06-04
Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$
Collection was deleted successfully
Bad Request: A parameter provided as a part of the request was invalid.
Unauthorized: the request requires an authentication token.
Forbidden: the request requires an authentication token with more or different permissions.
Not Found: The resource being operated on could not be found.
Conflict: The requested operation conflicts with the current state of the resource in some way.
Internal Server Error: An error was encountered while attempting to process the request.
DELETE /rest/orgs/{org_id}/collections/{collection_id} HTTP/1.1
Host: api.snyk.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
No content
Add projects to a collection by specifying an array of project ids
Org ID
Unique identifier for a collection
Requested API version
2021-06-04
Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$
successfully adding projects to a collection
Bad Request: A parameter provided as a part of the request was invalid.
Unauthorized: the request requires an authentication token.
Forbidden: the request requires an authentication token with more or different permissions.
Not Found: The resource being operated on could not be found.
Conflict: The requested operation conflicts with the current state of the resource in some way.
Internal Server Error: An error was encountered while attempting to process the request.
POST /rest/orgs/{org_id}/collections/{collection_id}/relationships/projects HTTP/1.1
Host: api.snyk.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 73
{
"data": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"type": "project"
}
]
}
No content
Return a list of organization's projects that are from the specified collection.
Org ID
Unique identifier for a collection
Requested API version
2021-06-04
Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$
Return the page of results immediately after this cursor
v1.eyJpZCI6IjEwMDAifQo=
Return the page of results immediately before this cursor
v1.eyJpZCI6IjExMDAifQo=
Number of results to return per page
10
Example: 10
Return projects sorted by the specified attributes
Return projects sorted in the specified direction
DESC
Possible values: Return projects that belong to the provided targets
Returns a list of projects from the specified collection
Bad Request: A parameter provided as a part of the request was invalid.
Unauthorized: the request requires an authentication token.
Forbidden: the request requires an authentication token with more or different permissions.
Not Found: The resource being operated on could not be found.
Internal Server Error: An error was encountered while attempting to process the request.
GET /rest/orgs/{org_id}/collections/{collection_id}/relationships/projects HTTP/1.1
Host: api.snyk.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"data": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"meta": {
"imported": "2021-05-29T09:50:54.014Z",
"issues_critical_count": 10,
"issues_high_count": 10,
"issues_low_count": 10,
"issues_medium_count": 10,
"last_tested_at": "2021-05-29T09:50:54.014Z"
},
"relationships": {
"target": {
"data": {
"id": "331ede0a-de94-456f-b788-166caeca58bf",
"type": "target"
}
}
},
"type": "resource"
}
],
"jsonapi": {
"version": "1.0"
},
"links": {
"first": "https://example.com/api/resource?ending_before=v1.eyJpZCI6IjExIn0K",
"last": "https://example.com/api/resource?starting_after=v1.eyJpZCI6IjMwIn0K",
"next": "https://example.com/api/resource?starting_after=v1.eyJpZCI6IjEwIn0K"
}
}
Remove projects from a collection by specifying an array of project ids
Org ID
Unique identifier for a collection
Requested API version
2021-06-04
Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$
successfully removing projects from a collection
Bad Request: A parameter provided as a part of the request was invalid.
Unauthorized: the request requires an authentication token.
Forbidden: the request requires an authentication token with more or different permissions.
Not Found: The resource being operated on could not be found.
Conflict: The requested operation conflicts with the current state of the resource in some way.
Internal Server Error: An error was encountered while attempting to process the request.
DELETE /rest/orgs/{org_id}/collections/{collection_id}/relationships/projects HTTP/1.1
Host: api.snyk.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 73
{
"data": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"type": "project"
}
]
}
No content
Last updated
Was this helpful?