Targets
Get a list of an organization's targets.
Required permissions
View Projects (org.project.read)
The id of the org to return a list of targets
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=
Calculate total amount of filtered results
Number of results to return per page
10
Example: 10
Return targets that match the provided value of is_private
Return only the targets that has projects
true
Return targets that match the provided remote_url.
Return targets with display names starting with the provided string
Return only targets which have been created at or after the specified date.
2022-01-01T16:00:00Z
A list of targets is returned for the targeted org
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}/targets HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
"data": [
{
"attributes": {
"created_at": "2022-09-01T00:00:00Z",
"display_name": "snyk-fixtures/goof",
"is_private": false,
"url": "http://github.com/snyk/local-goof"
},
"id": "55a348e2-c3ad-4bbc-b40e-9b232d1f4121",
"relationships": {
"integration": {
"data": {
"attributes": {
"integration_type": "gitlab"
},
"id": "7667dae6-602c-45d9-baa9-79e1a640f199",
"type": "integration"
}
},
"organization": {
"data": {
"id": "e661d4ef-5ad5-4cef-ad16-5157cefa83f5",
"type": "organization"
}
}
},
"type": "target"
}
],
"jsonapi": {
"version": "1.0"
},
"links": {
"first": "https://example.com/api/resource",
"last": "https://example.com/api/resource",
"next": "https://example.com/api/resource",
"prev": "https://example.com/api/resource",
"related": "https://example.com/api/resource",
"self": "https://example.com/api/resource"
},
"meta": {
"count": 3
}
}
Get a specified target for an organization.
Required permissions
View Projects (org.project.read)
The id of the org to return the target from
The id of the target to return
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))?))$
A single target is returned if it is found in the specified org
Bad Request: A parameter provided as a part of the request was invalid.
Unauthorized: the request requires an authentication token.
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}/targets/{target_id} HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
"data": {
"attributes": {
"created_at": "2022-09-01T00:00:00Z",
"display_name": "snyk-fixtures/goof",
"is_private": false,
"url": "http://github.com/snyk/local-goof"
},
"id": "55a348e2-c3ad-4bbc-b40e-9b232d1f4121",
"relationships": {
"integration": {
"data": {
"attributes": {
"integration_type": "gitlab"
},
"id": "7667dae6-602c-45d9-baa9-79e1a640f199",
"type": "integration"
}
},
"organization": {
"data": {
"id": "e661d4ef-5ad5-4cef-ad16-5157cefa83f5",
"type": "organization"
}
}
},
"type": "target"
},
"jsonapi": {
"version": "1.0"
},
"links": {
"first": "https://example.com/api/resource",
"last": "https://example.com/api/resource",
"next": "https://example.com/api/resource",
"prev": "https://example.com/api/resource",
"related": "https://example.com/api/resource",
"self": "https://example.com/api/resource"
}
}
Delete the specified target.
Required permissions
Remove Projects (org.project.delete)
The id of the org to delete
The id of the target to delete
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))?))$
The target is deleted with all projects, if it is found in the specified org.
Bad Request: A parameter provided as a part of the request was invalid.
Unauthorized: the request requires an authentication token.
Not Found: The resource being operated on could not be found.
Internal Server Error: An error was encountered while attempting to process the request.
DELETE /rest/orgs/{org_id}/targets/{target_id} HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
No content
Last updated
Was this helpful?