Start a bulk export job

πŸ“˜

When exporting a file from the CGC to an attached volume, export is possible only to a volume that is in the same location (cloud provider and region) as the project from which the file is being exported.

Bulk export files from your project on CGC into your volume. One call can contain up to 100 items.

Files selected for export must not be public files or aliases. Aliases are objects stored in your cloud storage bucket which have been made available on CGC. The volume you are exporting to must be configured for read-write access. To do this, set the access_mode parameter to RW when creating or modifying a volume.

Essentially, the call writes to your cloud storage bucket via the volume. If this call is successful, the original project files will become aliases to the newly exported objects on the volume. Source files will be deleted from CGC and, if no more copies of the files exist, they will no longer count towards your total storage price on CGC. In summary, once you export files from CGC to a volume, they are no longer part of the storage on CGC and cannot be exported again.

πŸ“˜

Please note that export from the CGC to Google Cloud Storage volumes is currently not supported.

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

Request

https://cgc-api.sbgenomics.com/v2/bulk/storage/exports/create

Example request

POST v2/bulk/storage/exports/create
Host: cgc-api.sbgenomics.com
X-SBG-Auth-Token: 3210a98c1db9318fa9d9273156740f74
curl -X POST \
  https://cgc-api.sbgenomics.com/v2/bulk/storage/exports/create \
  -H 'Content-Type: application/json' \
  -H 'X-SBG-Auth-Token: 3210a98c1db9318fa9d9273156740f74' \
  -d '{
    "items": [
        {
              "source": {
                "file": "5abce81631c948aa3c0dd2b7c"
              },
              "destination": {
                "volume": "rfranklin/output",
                "location": "output.vcf"
              },
              "overwrite": true,
              "properties": {
              "sse_algorithm": "AES256"
            }
        },
        {
              "source": {
                "file": "5abce81631c948aa3c0dd2b7f"
              },
              "destination": {
                "volume": "rfranklin/output",
                "location": "output.vcf"
              },
              "overwrite": false,
              "properties": {
              "sse_algorithm": "AES256"
            }
        }
         
    ]
}
'

Header Fields

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

Query parameters

KeyData typeDescription
copy_onlyBooleanIf set to true, the file will be copied to a volume but the source file will remain on CGC.

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
BooleanIf set to true, the file will be copied to a volume but the source file will remain on CGC.
file
required
StringThe ID of the file for export.
destination
required
ObjectThis object describes the destination to which the file will be exported.
volumeStringThe ID of the volume to which the files will be exported.
location
required
StringVolume-specific location to which the files will be exported.
This location should be recognizable to the underlying cloud service as a valid key or path to the new files.

Please note that if this volume has been configured with a prefix parameter, the value of prefix will be prepended to location before attempting to create files on the volume.
propertiesObjectService-specific properties of the export. These values override the defaults from the volume.
sse_algorithmStringS3 server-side encryption to use when exporting to this bucket.

Supported values:

AES256 (SSE-S3 encryption)
'aws:kms *null` (no server-side encryption).
default:AES256
sse_aws_kms_key_id
applies to type:s3
StringIf AWS KMS encryption is used, this should be set to the required KMS key. If not set and aws:kms is set as sse_algorithm, default KMS key is used.
aws_canned_aclStringIf AWS KMS encryption is used, this should be set to the required KMS key. If not set and aws:kms is set as sse_algorithm, default KMS key is used.
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

Example request (normal)

POST /v2/bulk/storage/exports/create HTTP/1.1  
Host: cgc-api.sbgenomics.com
X-SBG-Auth-Token: 3210a98c1db9318fa9d9273156740f74
Content-Type: application/json
{
    "items": [
        {
              "source": {
                "file": "5abce81631c948aa3c0dd2b7c"
              },
              "destination": {
                "volume": "rfranklin/output",
                "location": "output.vcf"
              },
              "overwrite": true,
              "properties": {
              "sse_algorithm": "AES256"
            }
        },
        {
              "source": {
                "file": "5abce81631c948aa3c0dd2b7f"
              },
              "destination": {
                "volume": "rfranklin/output",
                "location": "output.vcf"
              },
              "overwrite": false,
              "properties": {
              "sse_algorithm": "AES256"
            }
        }
         
    ]
}

Example request

POST /v2/bulk/storage/exports?copy_only=true HTTP/1.1  
Host: cgc-api.sbgenomics.com
X-SBG-Auth-Token: 3210a98c1db9318fa9d9273156740f74
Content-Type: application/json
{
    "items": [
        {
              "source": {
                "file": "5abce81631c948aa3c0dd2b7c"
              },
              "destination": {
                "volume": "rfranklin/output",
                "location": "output.vcf"
              },
              "overwrite": true,
              "properties": {
              "sse_algorithm": "AES256"
            }
        },
        {
              "source": {
                "file": "5abce81631c948aa3c0dd2b7f"
              },
              "destination": {
                "volume": "rfranklin/output",
                "location": "output.vcf"
              },
              "overwrite": false,
              "properties": {
              "sse_algorithm": "AES256"
            }
        }
         
    ]
}

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 information about all of the exported items. The information is structured using the following key-value pairs:

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://cgc-api.sbgenomics.com/v2/storage/exports/MiNOzItzc9HpRfZxoGp3AUDI8STJMZmI",
                "id": "MiNOzItzc9HpRfZxoGp3AUDI8STJMZmI",
                "state": "PENDING",
                "source": {
                    "file": "5abce81631c948aa3c0dd2b7c"
                },
                "destination": {
                    "volume": "rfranklin/output",
                    "location": "output.vcf"
                },
                "properties": {
                    "sse_algorithm": "AES256",
                    "sse_aws_kms_key_id": null,
                    "aws_canned_acl": null
                },
                "overwrite": true
            }
        },
        {
            "resource": {
                "href": "https://cgc-api.sbgenomics.com/v2/storage/exports/1sKqNbEI8nrb3CCer6OD3ATRz1XxDRIi",
                "id": "1sKqNbEI8nrb3CCer6OD3ATRz1XxDRIi",
                "state": "PENDING",
                "source": {
                    "file": "5abce81631c948aa3c0dd2b7f"
                },
                "destination": {
                    "volume": "rfranklin/output.vcf",
                    "location": "output.vcf"
                },
                "properties": {
                    "sse_algorithm": "AES256",
                    "sse_aws_kms_key_id": null,
                    "aws_canned_acl": null
                },
                "overwrite": false
            }
        }
    ]
}
Language