Get Information About All Query Jobs

Gets information about all query jobs in the org. The information includes Bulk API 2.0 query jobs and all Bulk API jobs.

Syntax

URI
/services/data/vXX.X/jobs/query
1/services/data/vXX.X/jobs/query/
2   ?isPkChunkingEnabled=isPkChunkingEnabled
3   &jobType=jobType
4   &concurrencyMode=concurrencyMode
5   &queryLocator=queryLocator
Available since release

This resource is available in API version 47.0 and later.

Formats
JSON
HTTP methods
GET
Authentication
Authorization: OAuth sessionId
Request parameters
Parameter Description Required or Optional
isPkChunkingEnabled If set to true, the request only returns information about jobs where PK Chunking is enabled. This only applies to Bulk API (not Bulk API 2.0) jobs.

For more information on PK Chunking, see Use PK Chunking to Extract Large Data Sets from Salesforce.

Optional
jobType Gets information only about jobs matching the specified job type. Possible values are:
  • BigObjectIngest—BigObjects ingest jobs.
  • Classic—Bulk API jobs. This includes both query jobs and ingest jobs.
  • V2Query—Bulk API 2.0 query jobs.
Optional
concurrencyMode For future use. Gets information only about jobs matching the specified concurrency mode. Possible values are serial and parallel.

Currently only parallel mode is supported.

Note

Optional
queryLocator Gets information about jobs starting with that locator value.

Do not enter your own value here. Always use the value from the nextRecordsUrl from the previous set.

Note

Optional
Response Body
The response contains a completion flag, an array of records, and a locator value to be used to obtain more records. For example:
1{
2   "done" : false,
3   "records" : [
4      {
5         "id" : "750R0000000zhfdIAA",
6         "operation" : "query",
7         "object" : "Account",
8         "createdById" : "005R0000000GiwjIAC",
9         "createdDate" : "2018-12-07T19:58:09.000+0000",
10         "systemModstamp" : "2018-12-07T19:59:14.000+0000",
11         "state" : "JobComplete",
12         "concurrencyMode" : "Parallel",
13         "contentType" : "CSV",
14         "apiVersion" : 46.0,
15         "jobType" : "V2Query",
16         "lineEnding" : "LF",
17         "columnDelimiter" : "COMMA"
18      },
19      {
20         "id" : "750R0000000zhjzIAA",
21         "operation" : "query",
22         "object" : "Account",
23         "createdById" : "005R0000000GiwjIAC",
24         "createdDate" : "2018-12-07T20:52:28.000+0000",
25         "systemModstamp" : "2018-12-07T20:53:15.000+0000",
26         "state" : "JobComplete",
27         "concurrencyMode" : "Parallel",
28         "contentType" : "CSV",
29         "apiVersion" : 46.0,
30         "jobType" : "V2Query",
31         "lineEnding" : "LF",
32         "columnDelimiter" : "COMMA"
33      },
34    ...
35   ],
36   "nextRecordsUrl" : "/services/data/v46.0/jobs/ingest?queryLocator=01gR0000000opRTIAY-2000"
37}
Response Parameters
Parameter Description
done This is true if this is the last (or only) set of results. It is false if there are more results to fetch. See Rules and Guidelines.
records An array of record objects.
nextRecordsUrl

(Optional) Gets a specific set of records. This method returns up to 1,000 result rows per request. If there are more than 1,000 results, use the nextRecordsUrl to get the next set of results. See Rules and Guidelines.

This parameter is null if there are no more results to fetch.

Record Objects
Parameter Description
id The unique ID for this job.
operation The type of query. Possible values are:
  • query—Returns data that has not been deleted or archived. For more information, see query() in the SOAP API Developer Guide.
  • queryAll—Returns records that have been deleted because of a merge or delete, and returns information about archived Task and Event records. For more information, see queryAll() in the SOAP API Developer Guide.
object The object type being queried. For example: Account. If this is not specified, the API determines the object from the query.
createdById The ID of the user who created the job.
createdDate The UTC date and time when the job was created.
systemModstamp The UTC date and time when the API last updated the job information.
state
The current state of processing for the job. Possible values are:
  • UploadComplete—All job data has been uploaded and the job is ready to be processed. Salesforce has put the job in the queue.
  • InProgress—Salesforce is processing the job.
  • Aborted—The job has been aborted. See Abort a Query Job.
  • JobComplete—Salesforce has finished processing the job.
  • Failed—The job failed.

concurrencyMode Reserved for future use. How the request is processed. Currently only parallel mode is supported. (When other modes are added, the API will choose the mode automatically. The mode will not be user configurable.)
contentType The format to be used for the results. Currently the only supported value is CSV (comma-separated variables). Defaults to CSV.

Note

The actual separator may not be a comma. The columnDelimiter parameter specifies what character to use.
apiVersion The API version that the job was created in.
lineEnding The line ending used for CSV job data, marking the end of a data row. The default is LF. Possible values are:
  • LF—linefeed character
  • CRLF—carriage return character followed by a linefeed character
columnDelimiter The column delimiter used for CSV job data. The default value is COMMA. Possible values are:
  • BACKQUOTE—backquote character (`)
  • CARET—caret character (^)
  • COMMA—comma character (,)
  • PIPE—pipe character (|)
  • SEMICOLON—semicolon character (;)
  • TAB—tab character

Example

1curl --include --request GET \
2--header "Authorization: OAuth 00DR00000000nd2aAQ8AQORpU.gf72HWKXAOkAcjOhYvBfvXiqgkMcERVkxSauharjcilr8BxJRjou
3E5mopL2TvHflPMtRd4.FFl63Yuq5pmhPaa1" \
4--header "Content-Type: application/json" \
5"https://instance.salesforce.com/services/data/v46.0/jobs/query"

Rules and Guidelines

  1. Use /services/data/vXX.X/jobs/query to get the first set of records.
  2. If there are more records than can be listed, the response body has done set to false and contains a nextRecordsUrl. Use that to get the next set of records.
  3. Repeat this process until done is true. That set is the last set of records.