Skip to main content

Get Job Results

Zuora

Get Job Results

This REST API retrieves an aggregate query using the Job ID.

Note that the completed AQuA jobs that were created 180 days ago are deleted permanently from Zuora, so you cannot query these jobs through API or AQuA job finder.

Request

Environment Request
US Production GET https://rest.zuora.com/v1/batch-query/jobs/{id}
US API Sandbox GET https://rest.apisandbox.zuora.com/v1/batch-query/jobs/{id}
US Performance Test GET https://rest.pt1.zuora.com/v1/batch-query/jobs/{id}
US Cloud Production GET https://rest.na.zuora.com/v1/batch-query/jobs/{id}
US Cloud API Sandbox GET https://rest.sandbox.na.zuora.com/v1/batch-query/jobs/{id}
US Central Sandbox GET https://rest.test.zuora.com/v1/batch-query/jobs/{id}
EU Cloud Production GET https://rest.eu.zuora.com/v1/batch-query/jobs/{id}
EU Cloud API Sandbox GET https://rest.sandbox.eu.zuora.com/v1/batch-query/jobs/{id}
EU Central Sandbox GET https://rest.test.eu.zuora.com/v1/batch-query/jobs/{id}

Response Parameters

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.

apiVersion

The API version for the query. If an API version is not specified, the latest version is used by default. Using the latest WSDL version is most useful for reporting use cases. For integration purposes, specify the WSDL version to ensure consistent query behavior, i.e., what is supported and included in the response returned by the API.

As of API version 69 and later, Zuora changed the format of certain fields. See Date Field Changes in the SOAP API for more information and a list of affected fields.

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.

segments

Array of IDs of query results files. Replaces fileId for full data loads in stateful mode if File Segmentation is enabled.

Use Get Results Files to download each query results file. Each query results file contains at most 500,000 records and is formatted as requested in the batch job. Supported formats are CSV, GZIP, and ZIP.

batchType

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

batchId

A 32-character ID of the query batch.

project

The project field contains the unique ID of a data integration project for a particular partner. The dropdown list of this field displays project IDs for the past thirty days.

This field must be used together with partner field to uniquely identify a data integration target. 

This field is required only if you are using AQuA in stateful mode. Otherwise, if you are using AQuA in stateless mode, partner field can be null.

partner

The partner field indicates the unique ID of a data integration partner. The dropdown list of this field displays partner IDs for the past thirty days.

It must be used together with "project" field to uniquely identify a data integration target.  

For example, if a continuous AQuA session is to retrieve data incrementally for a

Salesforce.com Org 00170000011K3Ub, you can use partner as "Salesforce", and "project" as "00170000011K3Ub." 

This field is required only if you are using AQuA in stateful mode. Otherwise, if you are using AQuA in stateless mode, partner field can be null.

Zuora highly recommends you use the stateless mode instead of the stateful mode to extract bulk data. See Bulk data extraction from Zuora using AQuA for best practices.

Submit a request at Zuora Global Support to obtain a partner ID.

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.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.

startTime

The start time of the query. 

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.

encrypted

If enabled, you must supply the formatting (zip or unzip) first and decrypt it to get the actual contents.
Supported values are: pgp and none. 

JSON Example

HTTP request:

GET https://rest.zuora.com/v1/batch-query/jobs/{id}

GET https://rest.apisandbox.zuora.com/v1/batch-query/jobs/{id}

JSON response:

{
    "batches": [
        {
            "full": true,
            "name": "AccountingPeriod",
            "message": "",
            "query": "select Id,StartDate,EndDate,FiscalYear,Name,Status from AccountingPeriod",
            "status": "completed",
            "recordCount": 1,
            "apiVersion": "60.0",
            "fileId": "402881824835bb2a01483c19f8190259",
            "batchType": "zoqlexport",
            "batchId": "402881824835bb2a01483c19f7da0257"
        }
    ],
    "project": "00170000011K3Ub",
    "partner": "salesforce",
    "name": "Example",
    "id": "402881824835bb2a01483c19f7d70256",
    "version": "1.1",
    "format": "CSV",
    "startTime": "2014-09-03 08:20:07",
    "status": "completed",
    "encrypted": "none"
}

Curl Example

Curl request:

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

Curl response:

HTTP/1.1 200 OK 
Content-Type: application/json 
Date: Fri, 05 Sep 2014 11:34:35 GMT 
Transfer-Encoding: chunked 
Connection: Keep-Alive 
{ 
  "batches" : [ { 
    "full" : true, 
    "name" : "AccountingPeriod", 
    "query" : "select Id,StartDate,EndDate,FiscalYear,Name,Status from AccountingPeriod", 
    "status" : "completed", 
    "recordCount" : 132, 
    "batchId" : "e20b07474841608a01484592147305d3", 
    "apiVersion" : "59.0", 
    "segments" : [ "e20b07474841608a01484592159c05d7" ], 
    "batchType" : "zoqlexport" } ], 
  "project" : "00170000011K3Ub", 
  "partner" : "salesforce", 
  "name" : "Example", "id" : "e20b07474841608a01484592147005d2", 
  "version" : "1.1", 
  "startTime" : "2014-09-05 04:27:54", 
  "format" : "CSV", 
  "status" : "completed", 
  "encrypted" : "none" }