Start an import job

This call lets you queue a job to import a file from a volume into a project on the Platform. Essentially, you are importing a file from your cloud storage provider (Amazon Web Services or Google Cloud Storage) via the volume onto the Platform.

If successful, an alias will be created on the Platform. Aliases appear as files on the Platform and can be copied, executed, and modified as such. They refer back to the respective file on the given volume.

Learn more about using the Volumes API for Amazon S3 and for Google Cloud Storage.

https://api.sb.biodatacatalyst.nhlbi.nih.gov/v2/storage/imports

Request

Example request

POST /v2/storage/imports HTTP/1.1
Host: api.sb.biodatacatalyst.nhlbi.nih.gov
X-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74
Content-Type: application/json
curl --data '@import.json' -X POST -H "X-SBG-Auth-Token: ce7ae5ab85e946599298e88a3430fba0" -H "Content-Type: application/json" 'https://api.sb.biodatacatalyst.nhlbi.nih.gov/v2/storage/imports'

Header Fields

KeyDescription of value
X-SBG-Auth-Token
required
Your authentication token.
Content-type
required
application/json

Query parameters

KeyData type of valueDescription of value
overwriteBooleanIf this is set to True and a named file exists in the project where the alias is about to be created, the existing file will be deleted.

default: false

Request body

In the body, you should enter a list of key-value pairs. The keys and the values they take are described in the following table.

KeyData type of valueDescription of value
source
required
ObjectThis object should describe the source from which the file should be imported.
volume_id
required
StringVolume ID from which to import the file.
location
required
StringVolume-specific location pointing to the file to import. This location should be recognizable to the underlying cloud service as a valid key or path to the file.

Please note that if this volume was configured with a prefix parameter when it was created, the prefix will be prepended to location before attempting to locate the file on the volume.
destination
required
ObjectThis object should describe the Platform destination for the imported file.
project
required
StringThe project in which to create the alias.
nameStringThe name of the alias to create. This name should be unique to the project. If the name is already in use in the project, you should use the overwrite query parameter in this call to force any file with that name to be deleted before the alias is created.

If name is omitted, the alias name will default to the last segment of the complete location (including the prefix) on the volume. Segments are considered to be separated with forward slashes ('/').
overwriteBooleanWhether to overwrite the file if the file with the same name already exists in the destination.

Example request body

{  
   "source":{  
      "volume":"rfranklin/input",
      "location":"example_human_Illumina.pe_1.fastq"
   },
   "destination":{  
      "project":"rfranklin/my_project",
      "name":"my_uploaded_example_human_Illumina.pe_1.fastq"
   },
   "overwrite": true
}
{ 
   "source":{ 
      "volume":"rfranklin/tutorial_volume",
      "location":"example_human_Illumina.pe_1.fastq"
   },
   "destination":{ 
      "project":"rfranklin/my-project",
      "name":"my_imported_example_human_Illumina.pe_1.fastq"
   },
   "overwrite": true
}

Response

See a list of response codes that may be contained in the body of the response.

Response body

The response object contains information about the specified volume. The information is structured using the following key-value pairs:

KeyData type of valueDescription of value
idStringID of this import job
stateStringThe state of this import job. Possible values are:
PENDING: the import is queued;
RUNNING: the import is running;
COMPLETED: the import has completed successfully;
FAILED: the import has failed.
sourceObjectImport source, as passed when this job was started by the call to start an import job .
destinationObjectImport destination, as passed when this job was started by the call to start an import job
resultObjectFile object that was imported.
errorObjectIn case of error in the import job, standard API error is returned here.

Example response body

{
  "href": "https://api.sb.biodatacatalyst.nhlbi.nih.gov/v2/storage/imports/Yrand0mERJY4F3grand0mzh5UuTdw2Ap",
  "id": "Yrand0mERJY4F3grand0mzh5UuTdw2Ap",
  "state": "PENDING",
  "overwrite": true,
  "source": {
    "volume": "rfranklin/input",
    "location": "example_human_Illumina.pe_1.fastq"
  },
  "destination": {
    "project": "rfranklin/my_project",
    "name": "my_uploaded_example_human_Illumina.pe_1.fastq"
  }
}