GET Jobs from Related Job Templates

You might want to get all of the jobs that have been run from the same job template, or subsequent edits of that job template. This is useful to see how the performance of the results in that job changes over time.

For example, if you have a job template set up to test your website against your competitors every day, you might want to extract the results from the API to display on a dashboard. This is similar to what the Speed Analysis chart shows you in the portal.

Request

Note that you are searching for jobs based on the given sref for the job template. Refer to Get One Job Template for more details on discovering the sref for job templates.

Method GET
Path /jobs?jobTemplate=job_template_sref
Header

Realm: account_realm

Authorization: Bearer access_token

The sref for the job template must be URL encoded, so, for example, if you are searching for jobs that have run from the job template 6789 (which would have an sref of jobTemplates/6789), your request would look like this:

Path /jobs?jobTemplate=jobTemplates%2F6789

Response

The response for this request is an array of job objects:

Body

"results": [

{

"name": "Homepage",

"url": "http://www.mydomain.com",

"startedAt": "2017-02-27T13:19:11+00:00",

"updatedAt": "2017-02-27T13:19:53+00:00",

"startedBy": "Joe Bloggs",

"type": "Single",

"pageCount": 1,

"status": "completed",

"sref": "jobs/12345",

"jobTemplateUri": "jobTemplates/6789",

"runType": "manual",

"testRunsUri": "testRuns?job=jobs%2F12345"

},

{

"name": "Homepage",

"url": "http://www.mydomain.com",

"startedAt": "2017-02-28T13:19:11+00:00",

"updatedAt": "2017-02-28T13:19:53+00:00",

"startedBy": "Joe Bloggs",

"type": "Single",

"pageCount": 1,

"status": "completed",

"sref": "jobs/12345",

"jobTemplateUri": "jobTemplates/6789",

"runType": "manual",

"testRunsUri": "testRuns?job=jobs%2F12345"

},

...

]

Job Parameters

Each job you request from the API includes the following parameters:

Parameter Details
name The name of the job
url The main URL for the job
startedAt The date and time the job started
updatedAt The date and time the job last updated. If the job is still running, this is updated as test run results become available.
startedBy The person who ran the job. Jobs run from the API show as being run by the Performance Analyzer API user.
type The type of job: Single, Multi, Crawl, or Scripted
pageCount The number of test run results available for the job. If the job is still running, this number increases as results become available.
status

The status of the job:

  • pending: The job has been submitted but hasn’t yet started to run
  • running: The job is in progress and results will start to become available
  • failed: The job has failed to run; try running it again or contact Support
  • completed: The job has finished, and all results are available
  • cancelled: A user stopped the job before it finished
  • expired: The crawl has taken longer than allowed, so it has been stopped
sref A self-reference path that describes how you can request the individual job
jobTemplateUri The URI of the job template used to run this job, i.e., the job template’s sref. The job template contains the parameters defines how the job should run.
runType

How the job ran:

  • manual: The job was run manually from the portal, or via the API
  • scheduled: The job was run from the scheduler
testRunsUri The URI of how to discover the test runs (results) for this job

Limit Jobs by Date and Time

You can restrict the search for jobs by the date and time they happened. You can specify the fromDate, the toDate, or both together. All dates and times are inclusive and are specified using the standard date/time format the API returns data in, but must be URL encoded and sent as a query string.

Request

Method GET
Path /jobs?fromDate=from_date&toDate=to_date
Header

Realm: account_realm

Authorization: Bearer access_token

All date/times must be URL encoded, so, for example, if you wanted to search for all jobs that ran before January 1, 2017, (represented as 2017-01-01T00:00:00+00:00 in ISO date format), you would make the following request:

Path /jobs?fromDate=2017-01-01T00%3A00%3A00%2B00%3A00

Response

The returned pagination will honor the date and time range you have specified, meaning you can retrieve all of the data from that date or time range, even if it spans multiple paginated pages. The response will include the date ranges specified, as well as the total number of results in the meta section:

Body

"meta": {

"fromDate": "2017-03-01T00:00:00+00:00",

"toDate": "2017-03-01T23:59:59+00:00",

"paginationTotalResults": 66,

"response_in_sec": 0.28

},

 

This topic was last updated on August 19, 2021, at 03:30:47 PM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2022 Eggplant