How can we help?

Jobs API

Overview

The Jobs resource contains all background job activity and status.

  • API set name: jobs

Additional information

  • Jobs are generated by the application to manage and track contact imports and exports using the contactimports and contactexports APIs.
  • The job information includes job status, job ID, job name, total items, completed items and start and end times.
  • For import jobs specifically, jobs also include total records, number updated, number inserted, number rejected, duplicate records, invalid records and new records.
  • Job names and IDs are given to the job automatically based on the API initiating the job type. For example, contactimports will assign the value of "ImportContacts" to the jobName.
  • Jobs can have a status of "Scheduled", "Pending", "Processing", "Failed" and "Done".
  • Jobs records are retained for 60 days.
  • Job rejections and Import Rejections are downloadable in the UI.
  • Job rejections are retained for 7 days.

Resource associations

The following resource collections are associated to this collection.

Collection Association
contactimports The contactimports resource creates job documents/records in the jobs collection/resource.
contactexports The contactexports resource creates job documents/records in the jobs collection/resource.

GET /jobs

Method URI Path
GET /jobs
Retrieves all jobs from the Cordial database.

Query string parameters

Parameter Type Description Example
jobName string Name given to the job.
?jobName=ImportContacts
times[start][gt] string Returns results where the start time is greater than specified date.
?times%5Bstart%5D%5Bgt%5D=01-01-2018
times[start][gte] string Returns results where the start time is greater than or equal to the specified date.
?times%5Bstart%5D%5Bgte%5D=01-01-2018
times[start][lt] string Returns results where the start time is less than specified date.
?times%5Bstart%5D%5Blt%5D=01-01-2018
times[start][lte] string Returns results where the start time is less than or equal to the specified date.
?times%5Bstart%5D%5Blte%5D=01-01-2018
times[end][gt] string Returns results where the end time is greater than specified date.
?times%5Bend%5D%5Bgt%5D=01-01-2018
times[end][gte] string Returns results where the end time is greater than or equal to the specified date.
?times%5Bend%5D%5Bgte%5D=01-01-2018
times[end][lt] string Returns results where the end time is less than the specified date.
?times%5Bend%5D%5Blt%5D=01-01-2018
times[end][lte] string Returns results where the end time is less than or equal to the specified date.
?times%5Bend%5D%5Blte%5D=01-01-2018
status string The active job status.
Possible Values:
Scheduled, Pending, Processing, Failed, Done
?status=Scheduled
page string Specifies the results page number.
?page=3
per_page string Specifies the number of records returned per page.
?per_page=100

Example request URIs

The following URI will retrieve all jobs and include all fields.

http://<path>/jobs

The following URI will retrieve the job with the "jobName" of "ImportContacts".

http://<path>/jobs?jobName=ImportContacts

The following URI will retrieve all jobs, but will only include jobs that have a "status" of "Failed".

http://<path>/jobs?status=Failed

The following URI will retrieve all jobs starting from the third page grouping jobs by 10. For example, page-1 would have included the first 10, page-2 the second group of 10 and so on.

http://<path>/jobs?page=3&per_page=10

GET /jobs/{id}

Method URI Path
GET /jobs/{id}
Retrieves a specific job record from the Cordial database.

The job record is defined by the job's unique "id" value.

For example, /jobs/548817d0367df1ef518b4567 would return the response data for the job with the id of "548817d0367df1ef518b4567".

Example request URI

The following URI will retrieve the job with the "id" value of "123123".

http://<path>/jobs/123123

Error responses

The Cordial API will return an error object with an errorKey and message if there is a problem with an API call. Below is a list of errors specific to the Jobs API endpoint, along with suggested modifications to resolve each error. If you receive an error from the Jobs API endpoint that is not listed in this table, it is likely recorded within the Global API Error Responses page.

errorKey Message Modifications
JOBS_COULD_NOT_BE_CREATED Job could not be created Ensure input values are correct.
JOBS_INCORRECT_FILTER Time value is incorrect Time values should be in ISO 08601 date format e.g. YYYY-MM-DDThh:mm:ss.

Comments

0 comments

Please sign in to leave a comment.