Post Query
This AQuA REST API submits an aggregated list of ZOQL and Export ZOQL queries.
Request
Environment | Request |
---|---|
US Cloud 2 Production | POST https://rest.zuora.com/v1/batch-query/ |
US Cloud 2 API Sandbox | POST https://rest.apisandbox.zuora.com/v1/batch-query/ |
US Performance Test | POST https://rest.pt1.zuora.com/v1/batch-query/ |
US Cloud 1 Production | POST https://rest.na.zuora.com/v1/batch-query/ |
US Cloud 1 Sandbox | POST https://rest.sandbox.na.zuora.com/v1/batch-query/ |
US Central Sandbox | POST https://rest.test.zuora.com/v1/batch-query/ |
EU Cloud Production | POST https://rest.eu.zuora.com/v1/batch-query/ |
EU Cloud API Sandbox | POST https://rest.sandbox.eu.zuora.com/v1/batch-query/ |
EU Central Sandbox | POST https://rest.test.eu.zuora.com/v1/batch-query/ |
Request Parameters
format |
The supported values are csv, zip and gzip. The default value is csv. |
|||||||||||
version |
The API version you want to use. Supported versions:
See Stateless and Stateful Modes for more information. |
|||||||||||
name |
The name of the job. 32 character limit. |
|||||||||||
encrypted |
If enabled, you must supply the formatting (zip or unzip) first and decrypt it to get the actual contents. |
|||||||||||
useQueryLabels |
When this optional flag is set to true the request will use object and field API names for the CSV header output instead of the field labels. Data integration projects should set By default |
|||||||||||
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. |
|||||||||||
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. |
||||||||||||
dateTimeUtc When using WSDL 69 and later you can ensure that the exported output of dateTime records are rendered according to ISO-8601 generic UTC form by setting When "
|
||||||||||||
nullReplacement The string used to represent null values in the query results. If you do not set this parameter, null values are represented by the empty string in the query results. |
||||||||||||
queries A JSON Array object that contains a list of query objects. The list of query objects are name and query.
|
Response Parameters
Batches A JSON array object that contains a list of batch objects.
|
||||||||||||||||
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. |
|||||||||||||||
version |
The API version you want to use. Supported versions:
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:
|
|||||||||||||||
encrypted |
If enabled, you must supply the formatting (zip or unzip) first and decrypt it to get the actual contents. |
|||||||||||||||
useLastCompletedJobQueries |
If this flag is set to true, then all the previous queries are merged with existing queries. |
Examples
HTTP request:
POST
{{aqua_url}}/batch-query/
POST
{{aqua_url_sbx}}/batch-query/
JSON request:
{ "format" : "csv", "version" : "1.1", "name" : "Example", "encrypted" : "none", "useQueryLabels" : "true", "partner" : "salesforce", "project" : "00170000011K3Ub", "dateTimeUtc" : "true", "queries" : [ { "name" : "AccountingPeriod", "query" : "select Id,StartDate,EndDate,FiscalYear,Name,Status from AccountingPeriod", "type" : "zoqlexport" }] }
JSON response (Full load):
{ "encrypted": "none", "partner": "salesforce", "useLastCompletedJobQueries": false, "project": "00170000011k3ub", "batches": [ { "localizedStatus": "pending", "apiVersion": "91.0", "full": false, "recordCount": 0, "batchId": "2c92c0f966cd4f580166ec0ac8a75bb8", "batchType": "zoqlexport", "status": "pending", "name": "AccountingPeriod", "query": "select Id,StartDate,EndDate,FiscalYear,Name,Status from AccountingPeriod" } ], "status": "submitted", "name": "Example", "id": "2c92c0f966cd4f580166ec0ac89d5bb7", "version": "1.1", "format": "CSV" }
JSON request:
{ "format" : "csv", "version" : "1.1", "name" : "Example", "encrypted" : "none", "useQueryLabels" : "true", "partner" : "salesforce", "project" : "00170000011K3Ub", "dateTimeUtc" : "true", "queries" : [ { "name" : "AccountingPeriod", "query" : "select Id,StartDate,EndDate,FiscalYear,Name,Status from AccountingPeriod", "type" : "zoqlexport" }] }
JSON response (Incremental load):
{ "encrypted": "none", "partner": "salesforce", "useLastCompletedJobQueries": false, "project": "00170000011k3ub", "batches": [ { "localizedStatus": "pending", "apiVersion": "91.0", "full": false, "recordCount": 0, "batchId": "2c92c0f966cd4f580166ec0ac8a75bb8", "batchType": "zoqlexport", "status": "pending", "name": "AccountingPeriod", "query": "select Id,StartDate,EndDate,FiscalYear,Name,Status from AccountingPeriod" } ], "status": "submitted", "name": "Example", "id": "2c92c0f966cd4f580166ec0ac89d5bb7", "version": "1.1", "format": "CSV" }
Curl request:
When processing a request through a curl shell script, you must enclose the field value in nested single double single quotes, such as Invoice.Status='"'Posted'"'
USER_NAME="ZUORA_API_USERNAME" PASSWORD="PASSWORD" BASE_URL="https://www.zuora.com/apps" echo echo "============= Posting the Aqua Job ===========" echo curl -i -k -u $USER_NAME:$PASSWORD -H "Content-Type:application/json" -H "Accept:application/json" -d ' { "format" : "csv", "version" : "1.1", "name" : "Example", "encrypted" : "none", "useQueryLabels" : "true", "partner" : "salesforce", "project" : "00170000011K3Ub", "dateTimeUtc" : "true", "queries" : [ { "name" : "Invoice", "query" : "select Invoice.Amount, Invoice.Balance, Invoice.InvoiceDate, Invoice.InvoiceNumber from Invoice where ( Invoice.Status='"'Posted'"')", "type" : "zoqlexport" }] } ' -X POST $BASE_URL/api/batch-query/
Curl response:
HTTP/1.1 200 OK Content-Type: application/json Date: Fri, 05 Sep 2014 11:27:54 GMT Transfer-Encoding: chunked Connection: Keep-Alive { "encrypted": "none", "partner": "salesforce", "useLastCompletedJobQueries": false, "project": "00170000011k3ub", "batches": [ { "localizedStatus": "pending", "apiVersion": "91.0", "full": false, "recordCount": 0, "batchId": "2c92c0f966cd4f580166ec0ac8a75bb8", "batchType": "zoqlexport", "status": "pending", "name": "AccountingPeriod", "query": "select Id,StartDate,EndDate,FiscalYear,Name,Status from AccountingPeriod" } ], "status": "submitted", "name": "Example", "id": "2c92c0f966cd4f580166ec0ac89d5bb7", "version": "1.1", "format": "CSV" }