Menu
AWS Batch
API Reference (API Version 2016-08-10)

ListJobs

Returns a list of task jobs for a specified job queue. You can filter the results by job status with the jobStatus parameter. If you do not specify a status, only RUNNING jobs are returned.

Request Syntax

POST /v1/listjobs HTTP/1.1 Content-type: application/json { "arrayJobId": "string", "jobQueue": "string", "jobStatus": "string", "maxResults": number, "nextToken": "string" }

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in JSON format.

arrayJobId

The job ID for an array job. Specifying an array job ID with this parameter lists all child jobs from within the specified array.

Type: String

Required: No

jobQueue

The name or full Amazon Resource Name (ARN) of the job queue with which to list jobs.

Type: String

Required: No

jobStatus

The job status with which to filter jobs in the specified queue. If you do not specify a status, only RUNNING jobs are returned.

Type: String

Valid Values: SUBMITTED | PENDING | RUNNABLE | STARTING | RUNNING | SUCCEEDED | FAILED

Required: No

maxResults

The maximum number of results returned by ListJobs in paginated output. When this parameter is used, ListJobs only returns maxResults results in a single page along with a nextToken response element. The remaining results of the initial request can be seen by sending another ListJobs request with the returned nextToken value. This value can be between 1 and 100. If this parameter is not used, then ListJobs returns up to 100 results and a nextToken value if applicable.

Type: Integer

Required: No

nextToken

The nextToken value returned from a previous paginated ListJobs request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value. This value is null when there are no more results to return.

Note

This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.

Type: String

Required: No

Response Syntax

HTTP/1.1 200 Content-type: application/json { "jobSummaryList": [ { "arrayProperties": { "index": number, "size": number }, "container": { "exitCode": number, "reason": "string" }, "createdAt": number, "jobId": "string", "jobName": "string", "startedAt": number, "status": "string", "statusReason": "string", "stoppedAt": number } ], "nextToken": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

jobSummaryList

A list of job summaries that match the request.

Type: Array of JobSummary objects

nextToken

The nextToken value to include in a future ListJobs request. When the results of a ListJobs request exceed maxResults, this value can be used to retrieve the next page of results. This value is null when there are no more results to return.

Type: String

Errors

ClientException

These errors are usually caused by a client action, such as using an action or resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying an identifier that is not valid.

HTTP Status Code: 400

ServerException

These errors are usually caused by a server issue.

HTTP Status Code: 500

Examples

In the following example or examples, the Authorization header contents (AUTHPARAMS) must be replaced with an AWS Signature Version 4 signature. For more information about creating these signatures, see Signature Version 4 Signing Process in the AWS General Reference.

You only need to learn how to sign HTTP requests if you intend to manually create them. When you use the AWS Command Line Interface (AWS CLI) or one of the AWS SDKs to make requests to AWS, these tools automatically sign the requests for you with the access key that you specify when you configure the tools. When you use these tools, you don't need to learn how to sign requests yourself.

Example

This example lists the running jobs in the HighPriority job queue.

Sample Request

POST /v1/listjobs HTTP/1.1 Host: batch.us-east-1.amazonaws.com Accept-Encoding: identity Content-Length: 28 Authorization: AUTHPARAMS X-Amz-Date: 20161129T201622Z User-Agent: aws-cli/1.11.22 Python/2.7.12 Darwin/16.1.0 botocore/1.4.79 { "jobQueue": "HighPriority" }

Sample Response

HTTP/1.1 200 OK Content-Type: application/json Content-Length: 89 Connection: keep-alive Date: Tue, 29 Nov 2016 20:16:22 GMT x-amzn-RequestId: b264511f-b670-11e6-b8df-d7216c30de5e X-Amzn-Trace-Id: Root=1-583de216-c8d6ac58e2bd21ac2d8284cf X-Cache: Miss from cloudfront Via: 1.1 7f3f42df8af148df1f9f1ee7175987ad.cloudfront.net (CloudFront) X-Amz-Cf-Id: idKR5mD8f7Luom03P9DV1bFGXsq_SIFNy_nMrTCOqZrRc0nXgHqZfg== { "jobSummaryList": [{ "jobId": "e66ff5fd-a1ff-4640-b1a2-0b0a142f49bb", "jobName": "example" }] }

Example

This example lists jobs in the HighPriority job queue that are in the SUBMITTED job status.

Sample Request

POST /v1/listjobs HTTP/1.1 Host: batch.us-east-1.amazonaws.com Accept-Encoding: identity Content-Length: 54 Authorization: AUTHPARAMS X-Amz-Date: 20161129T201642Z User-Agent: aws-cli/1.11.22 Python/2.7.12 Darwin/16.1.0 botocore/1.4.79 { "jobQueue": "HighPriority", "jobStatus": "SUBMITTED" }

Sample Response

HTTP/1.1 200 OK Date: Tue, 29 Nov 2016 20:16:42 GMT Content-Type: application/json Content-Length: 89 Connection: keep-alive x-amzn-RequestId: be15ca04-b670-11e6-aa0e-ef9532a24bfe X-Amzn-Trace-Id: Root=1-583de22a-fdc493168642bc6d4de19ba7 X-Cache: Miss from cloudfront Via: 1.1 ebc28fb0ad14691ee5d6c1a49f41b878.cloudfront.net (CloudFront) X-Amz-Cf-Id: Ngsjm0gBg2y4cDFG4uwpAmaKaT6Dejh7oGlVDmewQrUaeW_SPst_Bw== { "jobSummaryList": [{ "jobId": "68f0c163-fbd4-44e6-9fd1-25b14a434786", "jobName": "example" }] }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: