Start a bulk import job

This call lets you perform a bulk import of files from your volume (either Amazon Web Services or Google Cloud Storage) into your project on the Platform. One call can contain up to 100 items.

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.

Request

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

Example request

POST v2/bulk/storage/imports/create
Host: api.sb.biodatacatalyst.nhlbi.nih.gov
X-SBG-Auth-Token: 3259c50e1ac5426ea8f1373259740f75
curl -X POST \
  https://api.sb.biodatacatalyst.nhlbi.nih.gov/v2/bulk/storage/imports/create \
  -H 'Content-Type: application/json' \
  -H 'X-SBG-Auth-Token: b04aa2a2e98348a1a3a75ca677ea7fd7' \
  -d '{
    "items": [
        {
              "source": {
                "volume": "rfranklin/input",
                "location": "example_human_Illumina.pe_1.fastq"
              },
              "destination": {
                "project": "rfranklin/my_project",
                "name": "example_human_Illumina.pe_1.fastq"
              },
              "overwrite": true
        },{
              "source": {
                "volume": "rfranklin/input",
                "location": "example_human_Illumina.pe_2.fastq"
              },
              "destination": {
                "project": "rfranklin/my_project",
                "name": "example_human_Illumina.pe_2.fastq"
              },
              "overwrite": true
        }
    ]
}
'

Header Fields

NameDescription
X-SBG-Auth-Token
required
Your authentication token.
Content-Type
required
application/json

Request body

For every item in the request body, you should enter the list of key-value pairs described in the table below. One API call can contain up to 100 items.

KeyData typeDescription
source
required
objectThis object should describe the source from which the file should be imported.
volume
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 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 ('/').

Example request body

{
    "items": [
        {
              "source": {
                "volume": "rfranklin/input",
                "location": "example_human_Illumina.pe_1.fastq"
              },
              "destination": {
                "project": "rfranklin/my_project",
                "name": "example_human_Illumina.pe_1.fastq"
              },
              "overwrite": true
        },{
              "source": {
                "volume": "rfranklin/input",
                "location": "example_human_Illumina.pe_2.fastq"
              },
              "destination": {
                "project": "rfranklin/my_project",
                "name": "example_human_Illumina.pe_2.fastq"
              },
              "overwrite": true
        }
    ]
}

Response

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

Response body

KeyData typeDescription
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 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

{
    "items": [
        {
            "resource": {
                "href": "https://api.sb.biodatacatalyst.nhlbi.nih.gov/v2/storage/imports/wMtBbkNxJ7ldKtkZ3hC3eisVr3DtQcT3",
                "id": "wMtBbkNxJ7ldKtkZ3hC3eisVr3DtQcT3",
                "state": "PENDING",
                "overwrite": true,
                "source": {
                    "volume": "rfranklin/input",
                    "location": "example_human_Illumina.pe_1.fastq"
                },
                "destination": {
                    "project": "rfranklin/my_project",
                    "name": "example_human_Illumina.pe_1.fastq"
                }
            }
        },
        {
            "resource": {
                "href": "https://api.sb.biodatacatalyst.nhlbi.nih.gov/v2/storage/imports/0vXu4HQe7WqdTZg9iRcetk0UePQZ2I9I",
                "id": "0vXu4HQe7WqdTZg9iRcetk0UePQZ2I9I",
                "state": "PENDING",
                "overwrite": true,
                "source": {
                    "volume": "rfranklin/input",
                    "location": "example_human_Illumina.pe_2.fastq"
                },
                "destination": {
                    "project": "rfranklin/my_project",
                    "name": "example_human_Illumina.pe_2.fastq"
                }
            }
        }
    ]
}