Newer Version Available
Abort a Query Job
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 hasn’t been deleted or archived. For more information, see query() in 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 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—The job is ready to be processed and 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 chooses the mode automatically. The mode isn’t 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/750R000000146UvIAIThe 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}