Newer Version Available

This content describes an older version of this product. View Latest

Abort a Query Job

Aborts a query job.
  • To abort a job, you must be the job’s creator or have the Manage Data Integrations permission.
  • You can only abort jobs that are in the following states:
  • UploadComplete
  • InProgress

Note

Syntax

URI
/services/data/vXX.X/jobs/query/queryJobId
Available since release

This resource is available in API version 47.0 and later.

Formats
JSON
HTTP methods
PATCH
Authentication
Authorization: Bearer token
Request body
The request body must be the following:
1{
2  "state": "Aborted"
3}
Request parameters
Parameter Description Required or Optional
queryJobId The ID of the query job to be deleted. Required
Response Body
If the request is successful, the response is similar to that for Get Results for a Query Job but the state is Aborted. For example:
1{
2   "id" : "750R000000146UvIAI",
3   "operation" : "query",
4   "object" : "Account",
5   "createdById" : "005R0000000GiwjIAC",
6   "createdDate" : "2018-12-18T16:15:31.000+0000",
7   "systemModstamp" : "2018-12-18T16:15:32.000+0000",
8   "state" : "Aborted",
9   "concurrencyMode" : "Parallel",
10   "contentType" : "CSV",
11   "apiVersion" : 46.0
12}
Response Parameters
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.
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 that is used for the results. Currently the only supported value is CSV.
apiVersion The API version that the job was created in.
Response Body - For an Unsuccessful Request
If the request fails, the server returns a non-200 status, and the request body shows details of the error. For example:
1HTTP/1.1 400 Bad Request
2[{
3	"errorCode": "INVALIDJOBSTATE",
4	"message": "Aborting already Completed Job not allowed"
5}]

Example

This example aborts the job with ID 750R000000146UvIAI:
1curl  --request PATCH \
2--header "Authorization: Bearer token" \
3--header "Content-Type: application/json" \
4--data '{
5  "state": "Aborted"
6}' \
7https://instance.salesforce.com/services/data/vXX.X/jobs/query/750R000000146UvIAI
The response is:
1{
2  "id": "750R000000146UvIAI",
3  "operation": "query",
4  "object": "Account",
5  "createdById": "005R0000000GiwjIAC",
6  "createdDate": "2018-12-18T20:51:39.000+0000",
7  "systemModstamp": "2018-12-18T20:51:41.000+0000",
8  "state": "Aborted",
9  "concurrencyMode": "Parallel",
10  "contentType": "CSV",
11  "apiVersion": 46.0
12}