Knowledge Center

Knowledge Center > API > Aggregate Query API (AQuA) > Delete a Running Job

Delete a Running Job

This REST API deletes the current job, only if the job is not complete. If the job is complete, an error is thrown.

Request

Environment Request
API Sandbox (US Data Center) DELETE https://apisandbox.zuora.com/apps/api/batch-query/jobs/{jobid}
Production (US Data Center) DELETE https://www.zuora.com/apps/api/batch-query/jobs/{jobid}
API Sandbox (EU Data Center) DELETE https://rest.sandbox.eu.zuora.com/v1/batch-query/jobs/{jobid}
Production (EU Data Center) DELETE https://rest.eu.zuora.com/v1/batch-query/jobs/{jobid}

Response Parameters

name

The name of the job. 32 character limit.

id

The job ID created for the AQuA API request. The job ID can be used for querying for the query status.
The ID exists only if the JSON request can be parsed and validated successfully. Otherwise, the job ID is null.

version

The API version you want to use. Supported versions:

  • 1.2 Supports both modes
  • 1.1 Supports both modes
  • 1.0 Default. Supports Stateless mode only

See Stateless and Stateful Modes for more information.

format

The supported values are csv, zip and gzip. The default value is csv.

status

The job status. Status types are:

  • Submitted: The job was successfully submitted upon successful validation of the JSON request.
  • Executing: The job is being processed.
  • Completed: The query was executed successfully. Click completed to download a gzip archive of the results.
  • Error: There are some validation errors in the JSON input, and the job ID will not be available.
  • Aborted: The execution stopped because one of the queries failed. Check the error code and error messages for more details.
  • Pending: The job is extracting data from the database.

batches

A JSON array object that contains a list of batch objects.

name

Name of the query supplied in the request.

message

The error message. The maximum size is 2048.

query

The requested query string.

status

The status of the batch execution:

  • pending: The query was validated and submitted to the query executor for processing.
  • executing: The query is being processed.
  • completed: The query was successfully executed.
  • aborted: The query execution failed.
  • cancelled: The query was not processed.

recordCount

The number of records included in the query output file.

fileId

The ID of the query results file.

Use Get Results Files to download the query results file. The query results file is formatted as requested in the batch job. Supported formats are CSV, GZIP, and ZIP.

batchId

A 32-character ID of the query batch.

batchType

The kind of batch job being submitted. Possible values are zoql or zoqlexport.

segments

The array of file IDs are sorted alphanumerically. Column headers are repeated in each segment. 

JSON Example

HTTP request: 

DELETE https://www.zuora.com/apps/api/batch-query/jobs/e20b07474688ad5001468daf10e501de

DELETE https://apisandbox.zuora.com/apps/api/batch-query/jobs/
e20b07474688ad5001468daf10e501de

JSON response:

{

    "name": "June10",

    "id": "e20b07474688ad5001468daf10e501de",

    "version": "1.1",

    "format": "CSV",

    "status": "cancelled",

    "batches": [

        {

            "name": "InvoiceItemAdjustment",

            "message": "",

            "query": "select AccountingCode,CancelledDate,CreatedDate,Id,InvoiceId,InvoiceItemName,

            InvoiceNumber,SourceType,AdjustmentNumber,ServiceStartDate,ServiceEndDate,AdjustmentDate,

            Amount,Status,AccountId,SourceId,Type,ReasonCode, UpdatedDate  from  InvoiceItemAdjustment",

            "status": "completed",

            "recordCount": 1580,

            "fileId": "e20b07474688ad5001468daf155f01f5",

            "batchId": "e20b07474688ad5001468daf10ea01df",

            "batchType": "zoqlexport"

        },

        {

            "name": "InvoiceAdjustment",

            "message": "",

            "query": "select AccountingCode,CancelledOn,CreatedDate,Id,ImpactAmount,Invoice.Id,

            InvoiceNumber,AdjustmentNumber,AdjustmentDate,Amount,Status,Account.Id,Type,ReasonCode,

            UpdatedDate  from  InvoiceAdjustment",

            "status": "completed",

            "recordCount": 411,

            "fileId": "e20b07474688ad5001468daf166601f6",

            "batchId": "e20b07474688ad5001468daf10ec01e0",

            "batchType": "zoqlexport"

        }

    ],

    "encrypted": "none"

}

Curl Example

Curl request:

echo 
echo "============= Aqua Job Delete ===========" 
echo curl -i -k -u $USER_NAME:$PASSWORD -H "Accept:application/json" -X DELETE $BASE_URL/api/batch-query/jobs/$JOBID

Curl response:

HTTP/1.1 200 OK 
Server: Apache-Coyote/1.1 
Content-Type: application/json 
Transfer-Encoding: chunked 
Date: Fri, 05 Sep 2014 11:52:30 GMT 
{ 
 "name": "DSEXPORT", 
 "id": "2c90839d46f936820146fd4ef77a1eb6", 
 "version": "1.1", 
 "format": "CSV", 
 "status": "cancelled", 
 "encrypted": "none", 
 "batches": [ 
     { 
       "name": "Account", 
       "query": "select AccountNumber,Id,CreditBalance,Name,Balance,TaxExemptStatus,AutoPay,Currency,PaymentGateway,PaymentTerm,SalesRepName,TaxExemptIssuingJurisdiction,TaxExemptEffectiveDate,TaxExemptExpirationDate,TaxExemptCertificateType,LastInvoiceDate,Status,TotalInvoiceBalance,CreatedDate,UpdatedDate, ParentId, CustomerServiceRepName, BillToContact.Id, SoldToContact.Id from Account", 
       "status": "completed", 
       "recordCount": 1322, 
       "batchType": "zoqlexport", 
       "batchId": "2c90839d46f936820146fd4ef77f1eb7", 
       "segments": [ 
          "2c90839d46f936820146fd4ef8c71ece", 
          "2c90839d46f936820146fd4ef8d21ecf", 
          "2c90839d46f936820146fd4ef8dd1ed0", 
          "2c90839d46f936820146fd4ef8e91ed1", 
          "2c90839d46f936820146fd4ef8f31ed3", 
          "2c90839d46f936820146fd4ef9021ed5", 
          "2c90839d46f936820146fd4ef90d1ed8", 
          "2c90839d46f936820146fd4ef9161edb", 
          "2c90839d46f936820146fd4ef9201ede", 
          "2c90839d46f936820146fd4ef9291ee2", 
          "2c90839d46f936820146fd4ef9311ee5", 
          "2c90839d46f936820146fd4ef93a1ee8", 
          "2c90839d46f936820146fd4ef9431eec", 
          "2c90839d46f936820146fd4ef94d1eef", 
          "2c90839d46f936820146fd4ef9561ef2", 
          "2c90839d46f936820146fd4ef9601ef6", 
          "2c90839d46f936820146fd4ef96a1efb", 
          "2c90839d46f936820146fd4ef9751efe", 
          "2c90839d46f936820146fd4ef97d1f03", 
          "2c90839d46f936820146fd4ef9861f0c", 
          "2c90839d46f936820146fd4ef9991f15", 
          "2c90839d46f936820146fd4ef9a11f1d", 
          "2c90839d46f936820146fd4ef9ab1f1e", 
          "2c90839d46f936820146fd4ef9bf1f21", 
          "2c90839d46f936820146fd4ef9c91f23", 
          "2c90839d46f936820146fd4ef9d31f26", 
          "2c90839d46f936820146fd4ef9da1f2e" 
       ] 
    }, 
 { 
     "name": "AccountingPeriod", 
     "query": "select Id,StartDate,EndDate,FiscalYear,Name,Status,UpdatedDate from AccountingPeriod", 
     "status": "submitted", 
     "recordCount": 0, 
     "batchType": "zoqlexport", 
     "batchId": "2c90839d46f936820146fd4ef7951ecc", 
     "segments": [ "2c90839d46f936820146fd4f061e23cf" 
      ] 
    } 
  ]  
 }
Last modified
19:03, 2 Aug 2017

Tags

Classifications

(not set)