POST Create a New Job Template

You can create a new job template, and specify the main parameters needed to create it. Crawl parameters cannot currently be configured. New crawls will set the values for maximum pages, etc., with the defaults that you see in the portal when creating a crawl.

For consistency across job types, browsers and URLs will always be specified as array elements, even through some job types only permit one of these. You can create job templates with a type of Single, Multi, or Crawl. You cannot create scripted jobs.

Job Template Parameters

Parameter Details
type Required. The type of job template to create: Single, Multi, or Crawl.
name Required. The name of the job template.
urls Required. An array of URLs to be defined for the job template. As in the portal, only one URL can be given for Single or Crawl templates. Multiple URLs can be given for a Multi template.
browsers Required. An array of browser URIs the job template should run tests in (as can be discovered using the /browsers request). As in the portal, only one URL can be given for Single or Crawl templates. Multiple URLs can be given for a Multi template.
description Optional. A description of the job template.
deviceProfile Optional. The URI of a device profile to be given to this job template (as can be discovered using the /deviceProfiles request).
networkSpeed

Optional. This is used to set the network speed for the job template. As with the portal, you can either use a predefined or custom speed.

The networkSpeed contains either the networkSpeedUri for a predefined speed (which can be discovered using the /networkSpeeds request), or a meta object that defines each of the network speed options as follows:

  • downloadKbps: The download throttle speed, in kbps
  • uploadKbps: The upload throttle speed, in kbps
  • latency: The latency in seconds (note that the portal is in ms)
  • packetLossRate: The percentage packet loss rate to apply.

If meta is being used to specify a custom speed, either omit networkSpeedUri or set it to null

Request

This example shows how to create a new single job in multiple browsers:

Method POST
Path /jobTemplates
Header

Realm: account_realm

Authorization: Bearer access_token

Body

{

"type": "Single",

"name": "My job template",

"urls": [

"http://my.url.com"

],

"browsers": [

"browsers/ch",

"browsers/ff",

"browsers/ie11"

],

"description": "Homepage tested in all browsers"

}

This example shows how to create a new multi job in Chrome:

Method POST
Path /jobTemplates
Header

Realm: account_realm

Authorization: Bearer access_token

Body

{

"type": "Multi",

"name": "My job template",

"urls": [

"http://my.url.com",

"http://your.url.com"

],

"browsers": [

"browsers/ch"

]

}

This example shows how to create a new crawl job in Chrome:

Method POST
Path /jobTemplates
Header

Realm: account_realm

Authorization: Bearer access_token

Body

{

"type": "Crawl",

"name": "My crawl template",

"urls": [

"http://my.url.com"

],

"browsers": [

"browsers/ch"

]

}

This example shows how to create a new crawl job in Firefox using a particular device profile:

Method POST
Path /jobTemplates
Header

Realm: account_realm

Authorization: Bearer access_token

Body

{

"type": "Crawl",

"name": "My crawl template",

"urls": [

"http://my.url.com"

],

"browsers": [

"browsers/ff"

],

"deviceProfile": "deviceProfiles/1"

}

This example shows how to create a new single job in Chrome with a particular device profile and predefined network speed:

Method POST
Path /jobTemplates
Header

Realm: account_realm

Authorization: Bearer access_token

Body

{

"type": "Single",

"name": "My single template",

"urls": [

"http://my.url.com"

],

"browsers": [

"browsers/ch"

],

"deviceProfile": "deviceProfiles/1",

"description": "Use predefined network speed and device profile",

"networkSpeed": {

"networkSpeedUri": "networkSpeeds/1"

}

}

This example shows how to create a new single job in Chrome with a particular device profile and custom network speed:

Method POST
Path /jobTemplates
Header

Realm: account_realm

Authorization: Bearer access_token

Body

{

"type": "Single",

"name": "My single template",

"urls": [

"http://my.url.com"

],

"browsers": [

"browsers/ch"

],

"deviceProfile": "deviceProfiles/1",

"description": "Set a custom network speed and a device profile",

"networkSpeed": {

"networkSpeedUri": null,

"meta": {

"downloadKbps": 1500,

"uploadKbps": 250,

"latency": 0.05,

"packetLossRate": 10

}

}

}

This example uses a custom network speed, so the networkSpeedUri must be either is set to null or omitted.

Response

The response includes the sref of the job template that was created:

Body

"results": {

"sref": "jobTemplates/123"

}

You can use the sref of the newly created job template to run a new job.

 

This topic was last updated on July 02, 2020, at 02:39:52 PM.

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