This tutorial will demonstrate how you can download an example file via DRS API. You can download any type of file, public or controlled, as long as:
- it resides in your project
- you have copy permission
- and proper authorization
To download a file using DRS API:
- Create a new project.
- For the purpose of this example we will add a public file by accessing the Public files tab and searching for
- Copy the file to your project. In addition:
- The DRS ID is equal to the file ID on the Seven Bridges Platform (5dc018a9e4b0bf4ae31e92fc for this one).
- The file ID is an integral part of the URL once you access the page with file details).
- The DRS endpoint is https://cgc-ga4gh-api.sbgenomics.com/ga4gh/drs/v1/
- Obtain the authentication token from: https://cgc.sbgenomics.com/developer#token and include it in the API call.
- Perform the following API call:
'$ curl -H "X-SBG-Auth-Token: <token>" 'https://cgc-ga4gh-api.sbgenomics.com/ga4gh/drs/v1/objects/4c33ae65e4b032ce3d94e9c'
The response will contain the
access_id parameter, which you will use within the API call for retrieving the URL for downloading the file.
- Perform the API call for obtaining the URL using the '
'$ curl -H "X-SBG-Auth-Token: <token>" 'https://cgc-ga4gh-api.sbgenomics.com/ga4gh/drs/v1/objects/4c33ae65e4b032ce3d94e9c/access/aws-us-east-1'
The response will contain the URL for downloading the file.
- Download the file.