Jobs API

Jobs API

Get a List of Background Jobs

URLs

Get background jobs on the current user’s organization

GET /ga/api/v2/jobs/all
GET /ga/api/v2/jobs/unfinished

Get background jobs across all organizations (system admin only)

GET /ga/api/v2/jobs/all_on_all_organizations
GET /ga/api/v2/jobs/unfinished_on_all_organizations

Get background jobs on the specified organization (system admin only)

GET /ga/api/v2/organizations/:organization_id/jobs/all
GET /ga/api/v2/organizations/:organization_id/jobs/unfinished

Request Parameters

begins_at__after

string

Filter results to only jobs whose begins_at comes after the given begins_at__after.
Must be a UNIX integer timestamp or ISO-8601 datetime string.

begins_at__before

string

Filter results to only jobs whose begins_at comes before the given begins_at__before.
Must be a UNIX integer timestamp or ISO-8601 datetime string.

finished_at__after

string

Filter results to only jobs whose finished_at comes after the given finished_at__after.
Must be a UNIX integer timestamp or ISO-8601 datetime string.

finished_at__before

string

Filter results to only jobs whose finished_at comes after the given finished_at__before.
Must be a UNIX integer timestamp or ISO-8601 datetime string.

state

string

Filter results to only jobs whose state is one of the values provided.

job_type

string

Filter results to only jobs whose job_type is one of the values provided.

Response

This endpoint returns paginated records with a default page size of 2000.

id

integer

The internal identifier for this background job

mailing_list_id

integer

The mailing list associated with this background job

organization_id

integer

The internal identifier for this background job’s organization

suppression_list_id

integer

The suppression list associated with this background job

state

string



The current status of this job.

State can be one of the following for each job_type:

Campaign

idle, failed, cancelled, finished, scheduled, sending

SubscriberImport

loading_immediate, idle, scheduled, loading_delayed, splitting, importing, paused, finished, failed, cancelled

SubscriberExport

idle, estimating, exporting, paused, finished, failed, cancelled

SuppressedAddressImport

idle, scheduled, splitting, importing, paused, finished, failed, cancelled

state2

string

Campaigns will have a secondary state, returned here.

Can be one of:

onhold_autowinner, paused_ssr_exception, paused_remote_list_error, paused,
sending.not_yet_started, sending.preparing_recip_list, sending.sending,
paused_quota, finished, terminated, crashed

paused

boolean

Whether this job is paused (true or false)

name

string

The name of this job

progress_value

integer

Numerator of the job’s current progress

progress_total

integer

Denominator of the job’s current progress

job_type

string

The type of job represented by this object.
Can be one of: Campaign, SubscriberImport, SubscriberExport, SuppressedAddressImport.

begins_at

string

Scheduled time that this job will begin

started_at

string

The time at which this job began

finished_at

string

The time at which this job finished

created_at

string

The time at which this job was created

retry_at

string

The job hit a failure condition and will retry at this time

Example

Note that the JSON response will not be “pretty formatted” as it is below.

GET /ga/api/v2/jobs/all_on_all_organizations
HTTP/1.1 200 OK
{
  "success": true,
  "data": [
    {
      "begins_at": null,
      "created_at": "2017-02-22T17:32:42Z",
      "finished_at": "2017-01-22T17:32:42Z",
      "id": 28,
      "job_type": "SubscriberImport",
      "mailing_list_id": 28,
      "name": "small-subscriber-file.csv",
      "organization_id": 28,
      "paused": false,
      "progress_total": null,
      "progress_value": 0,
      "retry_at": null,
      "started_at": null,
      "state": "finished",
      "state2": null,
      "suppression_list_id": null,
      "updated_at": "2017-02-22T17:32:42Z"
    },
    {
      "begins_at": null,
      "created_at": "2017-02-22T17:32:42Z",
      "finished_at": "2017-02-15T17:32:42Z",
      "id": 29,
      "job_type": "SubscriberImport",
      "mailing_list_id": 29,
      "name": "larger-subscriber-file.csv",
      "organization_id": 29,
      "paused": false,
      "progress_total": null,
      "progress_value": 0,
      "retry_at": null,
      "started_at": null,
      "state": "finished",
      "state2": null,
      "suppression_list_id": null,
      "updated_at": "2017-02-22T17:32:42Z"
    },
    {
      "begins_at": null,
      "created_at": "2017-02-22T17:32:42Z",
      "finished_at": null,
      "id": 30,
      "job_type": "SubscriberImport",
      "mailing_list_id": 30,
      "name": "first-import.csv",
      "organization_id": 30,
      "paused": false,
      "progress_total": null,
      "progress_value": 0,
      "retry_at": null,
      "started_at": null,
      "state": "importing",
      "state2": null,
      "suppression_list_id": null,
      "updated_at": "2017-02-22T17:32:42Z"
    }
  ],
  "error_code": null,
  "error_message": null,
  "page": 0,
  "per_page": 2000,
  "num_records": 3,
  "num_pages": 1
}