post https://cgc-api.sbgenomics.com/v2
This API call lets you perform a bulk file import through Data Repository Service (DRS).
Before you start using this API call, please read the following important notes:
- The maximum number of items to import per single API call is 100.
- The rate limit for this API call is 500 files in 5 minutes. If the limit is reached and there are items left to be imported, the import will continue automatically after the five-minute period expires.
- Importing DRS bundles is supported.
https://cgc-api.sbgenomics.com/v2/bulk/drs/imports/create
Request
Example request
POST v2/bulk/drs/imports/create HTTP/1.1
Host: cgc-api.sbgenomics.com
X-SBG-Auth-Token: 3210a98c1db9318fa9d9273156740f74
Content-Type: application/json
curl --data '@import.json' -X POST -H "X-SBG-Auth-Token: 3210a98c1db9318fa9d9273156740f74" -H "Content-Type: application/json" 'https://cgc-api.sbgenomics.com/v2/bulk/drs/imports/create HTTP/1.1'
Header Fields
Key | Description of value |
---|---|
X-SBG-Auth-Token required | Your CGC authentication token. |
Content-type required | Use application/json |
Request body
Key | Data type | Description of value |
---|---|---|
items | Object | Contains details about each of the import items. See the rows below for details. |
drs_uri | String | DRS URI of the file that you want to import, for example drs://caninedc.org/02249ad3-6008-426f-a17c-88daa00492fe |
parent | String | The ID of the target folder to which the item should be imported, for example 569cf5ede4b0307bc0412345 Should not be used together with project. If parent is used, the import will take place into the specified folder, within the project to which the folder belongs. If project is used, the items will be imported to the root of the project's files. |
project | String | The project in which to import the file. Should be specified in the username/project-slug format, for example rfranklin/my-project . |
name | String | The name of the file when imported to the destination. If the name is already in use in the project, the rule defined in conflict_resolution will apply. |
metadata | Object | Consists of key-value pairs of metadata fields that should be assigned to the imported files. Learn more |
conflict_resolution | String | Action to take if a file with the same name already exists in the project. Available values: OVERWRITE RENAME * SKIP Default: SKIP |
tags | Array of strings | Tags that will help label and differentiate the imported files in the project. Learn more |
Example request body
{
"conflict_resolution": "SKIP",
"items": [{
"drs_uri": "drs://nci-crdc.datacommons.io/1803d249-ae77-3bda-b191-86d333d7563f",
"project": "rfranklin/drs-import/",
"name": "test-file.ext",
"metadata": {
"study_id": "1",
"cohort": 4
}
}],
"tags": [
"ICDC"
]
}
Response
See a list of CGC-specific response codes that may be contained in the body of the response.
Response body
The response object contains the link for downloading the file.
Key | Data type | Description |
---|---|---|
href | String | URI of this import job, for example https://api.sbgenomics.com/v2/async/files/import/123475393598765 . |
id | String | ID of the import job. |
result | Array | Files and errors for each of the items in the bulk import job. |
started_on | String | Date and time when the import job started. |
finished_on | String | Date and time when the import job ended. |
state | String | Current state of the import job. Available values:SUBMITTED RESOLVING RUNNING FINISHED |
Example response body
{
"href": "https://cgc-api.sbgenomics.com/v2/bulk/drs/imports/123456575995750987",
"id": "123456575995750987",
"result": [],
"state": "SUBMITTED"
}