Get details of a copy job

v2/async/files/copy/{jobid}

This call gets the details of an asynchronous bulk copy job. This information will be available for up to a month after the job has been completed.

Request

https://api.sbgenomics.com/v2/async/files/copy/{jobid}
https://eu-api.sbgenomics.com/v2/async/files/copy/{jobid}

Example request

GET /v2/async/files/copy/70721895322947584
Host: api.sbgenomics.com
X-SBG-Auth-Token: 3259c50e1ac5336ea8f1253259740f75
curl -X GET \
  https://api.sbgenomics.com/v2/async/files/copy/70721895322947584 \
  -H 'Content-Type: application/json' \
  -H 'X-SBG-Auth-Token: d32c2976ffc04d0eb90c6c4fb4c0a465' \
from time import sleep
from sevenbridges import Api, AsyncJobStates

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

# send GET request to SB API
async_job = api.async_jobs.get_file_copy_job(id='70721895322947584')

print(async_job.id, async_job.type, async_job.state)
# wait for async job to finish
while async_job.state != AsyncJobStates.FINISHED:
    async_job.reload()
    sleep(secs=60)
file_copy_records = async_job.get_result()
for file_copy_record in file_copy_records:
    if file_copy_record.valid:
        file = file_copy_record.resource
        print(file.id, file.name)
    else:
        print(file_copy_record.error)

Header Fields

Name

Description

X-SBG-Auth-Token
required

Your Seven Bridges Platform authentication token.

Content-Type
required

application/json

Query parameters

Key

Data type

Description

ID
required

string

The ID of the copy job you are querying. This ID can be found within the API response for the call for copying files.

{
  "items": [
    {
      "file": "5c6d3f30e4b038563238932f",
      "parent": "",
      "project": "rfranklin/destination-project",
      "name": "my-new-file"
    },
    {
      "file": "5c6d3f30e4b038563238932b",
      "parent": "",
      "project": "rfranklin/destination-project",
      "name": ""
    },
    {
      "file": "5c6d3f30e4b0385632389331",
      "parent": "",
      "project": "rfranklin/destination-project",
      "name": ""
    }
  ]
}

Response

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

Response body

Key

Data type

Description

id

string

ID of this copy job

result

string

The result of the copy job.

type

string

The type of job which is COPY.

state

string

The following states are available:

SUBMITTED
RESOLVING
RUNNING
FINISHED

failed_files

string

The number of files that failed to copy.

completed_files

string

The number of files that were successfully copied.

total_files

string

The total number of files that were processed during the job.

started_on

string

The time and date the copy job started.

finished_on

string

The time and date the copy job has finished.

{
    "href": "https://api.sbgenomics.com/v2/async/files/copy/70721895322947584",
    "id": "70796015691698176",
    "result": [
        {
            "resource": {
                "href": "https://api.sbgenomics.com/v2/files/5c6e7e36e4b038560025d30a",
                "id": "5c6e7e36e4b038560025d30a"
            }
        },
        {
            "resource": {
                "href": "https://api.sbgenomics.com/v2/files/5c6e7e36e4b038560025d309",
                "id": "5c6e7e36e4b038560025d309"
            }
        },
        {
            "resource": {
                "href": "https://api.sbgenomics.com/v2/files/5c6e7e36e4b038560025d30b",
                "id": "5c6e7e36e4b038560025d30b"
            }
        }
    ],
    "type": "COPY",
    "state": "FINISHED",
    "failed_files": 0,
    "completed_files": 3,
    "total_files": 3,
    "started_on": "2019-02-21T10:32:21Z",
    "finished_on": "2019-02-21T10:32:22Z"
}