Jobs API

Jobs API

Get a list of background jobs

If the API key has system admin authority, this API endpoint will return all jobs on the system. If the API key has organization admin authority, it will only return jobs for the current organization.

URL (All background jobs)

This endpoint returns all jobs, regardless of status.

GET /ga/api/v2/jobs/all

URL (Only unfinished background jobs)

This endpoint will return unfinished jobs, that is jobs that are pending, scheduled, active, or paused.

GET /ga/api/v2/jobs/unfinished

Response

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

state2

string

Campaigns will have a secondary state, returned here

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

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 Request

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

> GET /ga/api/v2/jobs/all HTTP/1.1
> Authorization: Basic MTo1ZTk2NDY1Yzg4M2YzMzA5ZjAxMDVhMmUxMDc2NjMyYjY4N2U2MWQy
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5
> Host: SendSage-studio.dev
> Accept: */*
>
< HTTP/1.1 200 OK
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: Fri, 01 Jan 1990 00:00:00 GMT
< Content-Type: application/json; charset=utf-8
< X-UA-Compatible: IE=Edge
< Set-Cookie: _session_id=458055a23f26f844e74f8cd7300f6445; path=/; HttpOnly
< X-Request-Id: f6e40d578ed1d9c418cca45e1b7fe532
< X-Runtime: 0.025540
< Connection: close
{
   "success":true,
   "data":[
      {
         "begins_at":"2014-07-03T13:37:00Z",
         "created_at":"2014-07-03T13:37:33Z",
         "finished_at":null,
         "id":1,
         "job_type":"SubscriberImport",
         "mailing_list_id":12,
         "name":"50-subscribers.csv",
         "organization_id":1,
         "paused":false,
         "progress_total":null,
         "progress_value":0,
         "retry_at":null,
         "started_at":null,
         "state":"scheduled",
         "state2":null,
         "suppression_list_id":null,
         "updated_at":"2014-07-03T13:37:39Z"
      }
   ],
   "error_code":null,
   "error_message":null
}