List tasks you can access (primary method)

This call returns a list of tasks that you can access.

Request

https://api.sbgenomics.com/v2/tasks
https://eu-api.sbgenomics.com/v2/tasks

Example request

GET /v2/tasks HTTP/1.1
Host: api.sbgenomics.com
X-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74
curl -s -H "X-SBG-Auth-Token: 6282d5e2121d43e7900e9d52b15845e7" -H "content-type: application/json" -X GET "https://api.sbgenomics.com/v2/tasks"
from sevenbridges import Api

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

# send GET request to SB API
tasks = api.tasks.query()

for task in tasks:
    print(task.name, task.status, task.id)

Header Fields

Name

Description

X-SBG-Auth-Token
required

Your Seven Bridges Platform authentication token.

Query parameters

Name

Data type

Description

fields

string

Selector specifying a subset of fields to include in the response.

status

string

You can filter the returned tasks by their status. Set the value of status to one of the following values:
"QUEUED"
"DRAFT"
"RUNNING"
"COMPLETED"
"ABORTED"
"FAILED"

parent

string

Enter the task ID of the parent task to return all child tasks from that parent.

A parent task is a task that specifies criteria by which to batch its inputs into a series of further sub-tasks, called child tasks.

See the documentation on batching tasks for more details on how to run tasks in batches.

project

string

Enter the project ID of the project you wish to list the tasks from.

created_from

string

Enter the starting date for querying tasks created on the specified date and onwards (see below for more information).

created_to

string

Enter the ending date for querying tasks created until the specified date. You can use it in combination with created_from to specify a time interval.

started_from

string

Enter the starting date for querying tasks started on the specified date and onwards (see below for more information).

started_to

string

Enter the starting date for querying tasks started until the specified date (see below for more information).

ended_from

string

Enter the starting date for querying tasks that ended on a specified date (see below for more information).

ended_to

string

Enter the ending date for querying tasks that ended until a specified date.

order_by

string

Order returned results by the specified field. Allowed values:

  • created_time
  • start_time
  • name
  • end_time
  • created_by

Sort can be done only by one column.
The default value is created_time.

order

string

Sort results in ascending or descending order by specifying asc or desc, respectively. Only taken into account if order_by is explicitly specified.

The default value is asc.

origin_id

string

Enter an automation run ID to list all tasks created from the specified automation run.

Using the timestamps

The parameters created_from, created_to, started_from, started_to, ended_from and ended_to are timestamp parameters.

They can be used to query tasks that were created, started, or ended during a specified time interval. All query parameters can be combined.

For example, querying https://api.sbgenomics.com/v2/tasks?fields=_all&started_from=2016-12-26T12:46:25&ended_to=2016-12-28 will return all tasks which ran between December 26, 2016 at 12:46:25 and December 28.

Furthermore, the timestamp query parameters can be combined with other query parameters. For example, querying https://api.sbgenomics.com/v2/tasks?fields=_all&created_from=2016-12-26T12:46:25&status=FAILED will return all tasks which were created from December 26 onwards and have failed.

Date format

All dates should be entered using the UTC format (ISO 8601). Allowed formats are:

  1. T<HH:mm:ss>+/-<HH:mm> (use this format to specify the UTC offset, see below)
  2. yyyy-MM-ddTHH:mm:ss
  3. yyyy-MM-dd (when this format is used, the implicit time is 00:00:00)

Parameter

Description

yyyy

4 digits for the year (e.g. 2017)

T

special character followed by hours and minutes

ss

2 digits for seconds (e.g. "25)

MM

2 digits for a month (e.g. "02" for February)

mm

2 digits for minutes (e.g. "45")

HH

2 digits for an hour (e.g. "23")

dd

2 digits for a day (e.g. "01")

UTC - hh:mm

UTC + hh:mm

UTC offset (HH:mm)

The hours and minutes should be entered the same way as for the date but are used to specify the time offset (e.g. -05:00 = UTC-5). This means you can use your local time to query but have to specify the UTC offset.

Examples:

  1. 2016-04-01T14:25:50+01:00 - Fri Apr 01 13:25:50 UTC 2016
  2. 2016-04-01T14:25:50 - Fri Apr 01 14:25:50 UTC 2016
  3. 2016-04-01 - Fri Apr 01 00:00:00 UTC 2016

Response

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

Example response body

{
  "href": "https://api.sbgenomics.com/v2/tasks?offset=0&limit=25&project=RFranklin/my-project",
  "items": [
    {
      "href": "https://api.sbgenomics.com/v2/tasks/39bc3e8c-6cf6-4f8f-b550-21e9633c1f4b",
      "id": "39bc3e8c-6cf6-4f8f-b550-21e9633c1f4b",
      "name": "test run - 12-11-15 11:02:03",
      "project": "RFranklin/my-project"
    },
    {
      "href": "https://api.sbgenomics.com/v2/tasks/db72b963-ba2e-4e9c-9d71-6eb71ed22226",
      "id": "db72b963-ba2e-4e9c-9d71-6eb71ed22226",
      "name": "test run - 12-11-15 11:52:45",
      "project": "RFranklin/my-project"
    }
  ],
  "links": []
}