Skip to end of metadata
Go to start of metadata

Multiple Jobs Methods

Standard URL: https://saucelabs.com/rest/v1/

Finding Your Username and Access Key

You can find your Sauce Labs username and access key in the User Profile > User Settings section of your Sauce Labs dashboard. You should also check out our topic on setting your username and access key as environment variables.

MethodDescriptionURLMethod TypeRequest FieldsExample Request

Get Jobs

List recent jobs belonging to a specific user:username/jobsGET 
 OS X/Linux Example

curl https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs \ -u YOUR_USERNAME:YOUR_ACCESS_KEY 

 Windows Example

curl https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs  -u YOUR_USERNAME:YOUR_ACCESS_KEY

Get Number of Jobs

Specifies the number of jobs to return. Default is 100 and max is 500.

:username/jobs?limit=:number_of_jobsGET

 

Example for getting last 10 job IDs

 OS X/Linux Example

curl -u YOUR_USERNAME:YOUR_ACCESS_KEY \ https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs?limit=10

 Windows Example

curl -u YOUR_USERNAME:YOUR_ACCESS_KEY https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs?limit=10

Get Full Jobs

Get full job information, rather than just IDs. Default is false.:username/jobs?full=:get_full_infoGET 

Example getting full information about the last 100 jobs

 OS X/Linux Example

curl -u YOUR_USERNAME:YOUR_ACCESS_KEY \ https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs?full=true 

 Windows Example

curl -u YOUR_USERNAME:YOUR_ACCESS_KEY https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs?full=true 

Response Fields

  • id: [string] Job Id
  • owner: [string] Job owner
  • status: [string] Job status
  • error: [string] Error (if any) for the job
  • name: [string] Job name
  • browser: [string] Browser the job is using
  • browser_version: [string] Browser version the job is using
  • os: [string] Operating system the job is using
  • creation_time: [integer] The time the job was first requested
  • start_time: [integer] The time the job began executing
  • end_time: [integer] The time the job finished executing
  • video_url: [string] Full URL to the video replay of the job
  • log_url: [string] Full URL to the Selenium log of the job
  • public: [string or boolean] Visibility mode [public, public restricted, share (true), team (false), private]
  • tags: [array of strings] Tags assigned to a job

 

Skip Jobs

Skips the specified number of jobs. Default is 0.:username/jobs?skip=:number_of_jobsGET 

Example getting the last 100 job IDs, skipping 20 most recent jobs

 OS X/Linux Example

curl -u YOUR_USERNAME:YOUR_ACCESS_KEY \ https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs?skip=20 

 Windows Example

curl -u YOUR_USERNAME:YOUR_ACCESS_KEY https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs?skip=20

Jobs to and From Time

Get jobs since/until the specified time (in epoch time, calculated from UTC)

:username/jobs?to=:time 

and 

 :username/jobs?from=:time

GET 

Example Request (replace EPOCH_TIME with an epoch time)

 OS X/Linux Example

curl -u YOUR_USERNAME:YOUR_ACCESS_KEY \ https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs?from=EPOCH_TIME 

 Windows Example

curl -u YOUR_USERNAME:YOUR_ACCESS_KEY https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs?from=EPOCH_TIME 

Format Jobs

Get job info in the specified format. Supported formats are json and csv. Default is json.:username/jobs?format=:job_formatGET 

Example getting last 100 job IDs using the CSV format

 OS X/Linux Example

curl -u YOUR_USERNAME:YOUR_ACCESS_KEY \ https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs?format=csv 

 Windows Example

curl -u YOUR_USERNAME:YOUR_ACCESS_KEY https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs?format=csv

Single Job Methods

Standard URL: https://saucelabs.com/rest/v1/

MethodDescriptionURLMethod TypeRequest FieldsExample Request

Update Job

Edit an existing job:username/jobs/:job_idPUT
  • name: [string] Change the job name
  • tags: [array of strings] Change the job tags
  • public: [string or boolean] Set job visibility to "public", "public restricted", "share" (true), "team" (false) or "private"
  • passed: [boolean] Set whether the job passed or not on the user end
  • build: [int] The build number tested by this test
  • custom-data: [JSON] a set of key-value pairs with any extra info that a user would like to add to the job. Note that the max data allowed is 64KB

 

 OS X/Linux Example

curl -u YOUR_USERNAME:YOUR_ACCESS_KEY \ -X PUT \ -H "Content-Type: application/json" \ -d '{"tags": ["testing-rest-api"],  "name": "REST API Test",  "custom-data": {"source": "Testing REST API"}}' \ https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs/YOUR_JOB_ID

Updating Jobs for Windows Users

Because of the complex syntax required for updating job information via cURL, you should update job information using the methods described in Test Configuration and Annotation.. 

Delete Job

Removes the job from the system with all the linked assets:username/jobs/:job_idDELETE

 

 OS X/Linux Example

curl -u YOUR_USERNAME:YOUR_ACCESS_KEY \ -v \ -X DELETE \ https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs/YOUR_JOB_ID 

 Windows Example

curl -u YOUR_USERNAME:YOUR_ACCESS_KEY  -v  -X DELETE https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs/YOUR_JOB_ID 

Stop Job

Terminates a running job:username/jobs/:job_id/stopPUT 
 OS X/Linux Example

curl -u YOUR_USERNAME:YOUR_ACCESS_KEY \ -X PUT \ -d '' \ https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs/YOUR_JOB_ID/stop 

 Windows Example

curl -u YOUR_USERNAME:YOUR_ACCESS_KEY  -X PUT -d https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs/YOUR_JOB_ID/stop


Get Job Asset Names

Get details about the static assets collected for a specific job:username/jobs/:job_id/assetsGET 
 OS X/Linux Example
curl -u YOUR_USERNAME:YOUR_ACCESS_KEY \
https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs/YOUR_JOB_ID/assets

 

 Windows Example
curl -u YOUR_USERNAME:YOUR_ACCESS_KEY https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs/YOUR_JOB_ID/assets

Response Fields

Each of these fields will be set to null if the specific asset isn't captured for a job

  • sauce-log: [string] Name of the Sauce log recorded for a job
  • selenium-log: [string] Name of the selenium Server log file produced by a job
  • video: [string] Name of the video file name recorded for a job
  • screenshots: [array of strings] List of screenshot names captured by a job

 

Get Job Asset Files

Download job assets. After a job completes, all assets created during the job are available via this API. These include the screencast recording, logs, and screenshots taken on crucial steps.

The job assests will be deleted from the test page after 30 days. Thus, after 30 days all your test commands, logs, screenshots and the screencast recording will be gone. This is the reason why we strongly recommend to download your job assets if this is an information that you must keep in your records.

:username/jobs/:job_id/assets/:file_name

Accepted Values for :file_name

  • selenium-server.log
  • video.flv
  • XXXXscreenshot.png (where XXXX is a number between 0000 and 9999)
  • final_screenshot.png

 

GET 
 OS X/Linux Example

curl -u YOUR_USERNAME:YOUR_ACCESS_KEY \ -O \ https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs/YOUR_JOB_ID/assets/final_screenshot.png 

 Windows Example

curl -u YOUR_USERNAME:YOUR_ACCESS_KEY  -O https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs/YOUR_JOB_ID/assets/final_screenshot.png

Delete Job Assets

Delete all the assets captured during a test run. This includes the screencast recording, logs, and all screenshots.:username/jobs/:job_id/assetsDELETE 
 OS X/Linux Example

curl -u YOUR_USERNAME:YOUR_ACCESS_KEY \ -X DELETE \ https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs/YOUR_JOB_ID/assets 

 Windows Example

curl -u YOUR_USERNAME:YOUR_ACCESS_KEY  -X DELETE \https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs/YOUR_JOB_ID/assets

Write a comment…