Import Projects (v1)
Request a target to be analyzed for supported Snyk projects via a configured integration. See the Integrations API to configure a new integration.
The organization ID. The API_KEY
must have admin access to this organization.
4a18d42f-0706-4ad0-b127-24078731fbed
The unique identifier for the configured integration. This can be found on the Integration page in the Settings area for all integrations that have been configured.
9a3e5d90-b782-468a-a042-9a2073736f0b
Note: Importing targets through a Github (Cloud) integration requires the use of a Snyk personal access/api token.
{"target":{"owner":"org-security","name":"goof","branch":"main"},"files":[{"path":"example/package.json"}]}
POST /v1/org/{orgId}/integrations/{integrationId}/import HTTP/1.1
Host: api.snyk.io
Content-Type: application/json; charset=utf-8
Accept: */*
Content-Length: 107
{
"target": {
"owner": "org-security",
"name": "goof",
"branch": "main"
},
"files": [
{
"path": "example/package.json"
}
]
}
No content
The organization ID. The API_KEY
must have admin access to this organization.
4a18d42f-0706-4ad0-b127-24078731fbed
The unique identifier for the configured integration. This can be found on the Integration page in the Settings area for all integrations that have been configured.
9a3e5d90-b782-468a-a042-9a2073736f0b
The ID of the job. This can be found in the Location response header from the corresponding POST request that triggered the import job.
1a325d9d-b782-468a-a242-9a2073734f0b
application/json; charset=utf-8
Possible values: {"id":"dce061f7-ce0f-4ccf-b49b-4335d1205bd9","status":"pending","created":"2018-07-23T15:21:10.611Z","logs":[{"name":"org1/repo1","created":"2018-07-23T15:21:10.643Z","status":"failed","projects":[]},{"name":"org2/repo2","created":"2018-07-23T15:21:10.644Z","status":"complete","projects":[{"targetFile":"package.json","success":true,"projectUrl":"https://api.snyk.io/v1/org/org-name/project/7eeaee25-5f9b-4d05-8818-4cca2c9d9adc"}]},{"name":"org3/repo3","created":"2018-07-23T15:21:10.643Z","status":"pending","projects":[{"targetFile":"package.json","success":true,"projectUrl":"https://api.snyk.io/v1/org/org-name/project/0382897c-0617-4429-86df-51187dfd42f6"}]}]}
GET /v1/org/{orgId}/integrations/{integrationId}/import/{jobId} HTTP/1.1
Host: api.snyk.io
Content-Type: application/json; charset=utf-8
Accept: */*
{
"id": "dce061f7-ce0f-4ccf-b49b-4335d1205bd9",
"status": "pending",
"created": "2018-07-23T15:21:10.611Z",
"logs": [
{
"name": "org1/repo1",
"created": "2018-07-23T15:21:10.643Z",
"status": "failed",
"projects": []
},
{
"name": "org2/repo2",
"created": "2018-07-23T15:21:10.644Z",
"status": "complete",
"projects": [
{
"targetFile": "package.json",
"success": true,
"projectUrl": "https://api.snyk.io/v1/org/org-name/project/7eeaee25-5f9b-4d05-8818-4cca2c9d9adc"
}
]
},
{
"name": "org3/repo3",
"created": "2018-07-23T15:21:10.643Z",
"status": "pending",
"projects": [
{
"targetFile": "package.json",
"success": true,
"projectUrl": "https://api.snyk.io/v1/org/org-name/project/0382897c-0617-4429-86df-51187dfd42f6"
}
]
}
]
}
Last updated
Was this helpful?