Obtain the status of a job

You can use this operation to obtain the status of a batch job on z/OS®.

HTTP method and URI path

GET /zosmf/restjobs/jobs/<jobname>/<jobid>
GET /zosmf/restjobs/jobs/<correlator>

where:

Custom headers

None.

Query parameters

None.

Required authorizations

See Required authorizations.

Usage considerations

See Usage considerations for the z/OSMF REST services.

In addition, note that this request can be directed to a secondary JES subsystem. To do so, use the following URL format:
https://host:port/zosmf/restjobs/jobs/-JESB/jobname/jobid
where JESB is the name of the secondary JES subsystem. A request to a secondary JES subsystem must include the job name and job id, rather than a job correlator.

Expected response

On completion, the z/OS jobs REST interface returns an HTTP response with a JSON job document. For the contents, see Job document.

For errors, z/OS jobs REST interface returns an appropriate HTTP status code and error information as a JSON error report document. See Error report document.

Example request

The following request obtains the status for the job BLSJPRMI, job ID STC00052:
GET /zosmf/restjobs/jobs/BLSJPRMI/STC00052 HTTP/1.1
Host: zosmf1.yourco.com

Example response

A sample response is shown in Figure 1.
Figure 1. Example: Returned job status
HTTP/1.1 200 OK
Date: Thu, 09 Dec 2014 05:39:28 +0000GMT
Content-Type: application/json
Connection: close

{
  "jobid":"STC00052",
  "jobname":"BLSJPRMI",
  "subsystem":"JES2",
  "owner":"IBMUSER",
  "status":"OUTPUT",
  "type":"STC",
  "class":"STC",
  "retcode":"CC 0000",
  "url":"https:\/\/host:port\/zosmf\/restjobs\/jobs\/S0000052SY1.....CE35BDE8.......%3A",
  "files-url":"https:\/\/host:port\/zosmf\/restjobs\/jobs\/S0000052SY1.....CE35BDE8.......%3A\/files",
  "job-correlator":"S0000052SY1.....CE35BDE8.......:",
  "phase":20,
  "phase-name":"Job is on the hard copy queue"
}