Update details of multiple files

This call updates the details for multiple specified files. Use this call to set new information for the files, thus replacing all existing information and erasing omitted parameters.

For each of the specified files, the call sets a new name, new tags and metadata. The maximum number of files you can update the details for per call is 100.

Request

https://api.sbgenomics.com/v2/bulk/files/update
https://eu-api.sbgenomics.com/v2/bulk/files/update

Example request

POST v2/bulk/files/get
Host: api.sbgenomics.com
X-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f75
curl -X POST \
  https://api.sbgenomics.com/v2/bulk/files/get \
  -H 'Content-Type: application/json' \
  -H 'X-SBG-Auth-Token: b04aa2a2e98348a1a3a75ca677ea7fd7' \
  -d '{
    "file_ids" : ["5a97d4741c94edbe85904936", "5a97d4741c94edbe85904909"]
}'
from sevenbridges import Api

api = Api(url='https://api.sbgenomics.com/v2',
          token='3259c50e1ac5426ea8f1273259740f74')

files = api.files.query(project='rfranklin/my-project')
# set new values for files' names, metadata and/or tags
for file in files:
    file.name = '2_' + file.name

# send POST request to SB API
files_bulk = api.files.bulk_update(files=files)

for file_record in files_bulk:
    if file_record.valid:
        file = file_record.resource
        print(file.id, file.name)
    else:
        print(file_record.error)

Header Fields

Name

Description

X-SBG-Auth-Token
required

Your Seven Bridges Platform authentication token.

Content-Type
required

application/json

Request body

Key

Data type

Description

file_id

string

The IDs of the file you are updating. The maximum number of files you can update the details for per call is 100.

name

string

The new name of the file.

tags

array

The tags you want to update.

metadata

dictionary of key-value pairs

The metadata fields and their values that you want to update.

Response

See a list of Seven Bridges Platform-specific response codes that may be contained in the body of the response..

Response body

The response contains information the updated information for all of the edited files.

Example response body

{
    "items": [
        {
            "resource": {
                "href": "https://api.sbgenomics.com/v2/files/5a97d4741c94edbe85904936",
                "id": "5a97d4741c94edbe85904936",
                "name": "1000G_phase1.snps.high_confidence.b37.vcf",
                "size": 7313069069,
                "project": "rfranklin/my-project",
                "created_on": "2018-03-01T10:22:44Z",
                "modified_on": "2018-03-01T10:22:44Z",
                "storage": {
                    "type": "PLATFORM"
                },
                "origin": {},
                "tags": [tag1],
                "metadata": {“sample_id”: “sample1”}
            }
        },
        {
            "resource": {
                "href": "https://api.sbgenomics.com/v2/files/5a97d4701c94edbe8590471e",
                "id": "5a97d4701c94edbe8590471e",
                "name": "C835.HCC1143_BL.4.contig_1_mpileup_SNPs.filtered.Somatic.hc.and_more.concat.sorted.reordered.vcf",
                "size": 5313069069,
                "project": "rfranklin/my-project",
                "created_on": "2018-03-01T10:22:44Z",
                "modified_on": "2018-03-01T10:22:44Z",
                "storage": {
                    "type": "PLATFORM"
                },
                "origin": {},
                "tags": [],
                "metadata": {'sample_id”: “sample1'}
            }
        }
        }
    ]
}