Post Query with Time Offset
This REST API can submit an aggregate query to retrieve those records created or updated between the completion time of the previous query and the time calculated from the offset
parameter.
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.
Request
Environment | Request |
---|---|
Production for US Cloud Data Center 2 |
POST https://rest.zuora.com/v1/batch-query/ |
API Sandbox for US Cloud Data Center 2 | POST https://rest.apisandbox.zuora.com/v1/batch-query/ |
US Performance Test | POST https://rest.pt1.zuora.com/v1/batch-query/ |
Production for US Cloud Data Center 1 | POST https://rest.na.zuora.com/v1/batch-query/ |
API Sandbox for US Cloud Data Center 1 | POST https://rest.sandbox.na.zuora.com/v1/batch-query/ |
Central Sandbox for US Cloud Data Center | POST https://rest.test.zuora.com/v1/batch-query/ |
Production for EU Cloud Data Center | POST https://rest.eu.zuora.com/v1/batch-query/ |
Sandbox for EU Cloud Data Center | POST https://rest.sandbox.eu.zuora.com/v1/batch-query/ |
Central Sandbox for EU Cloud Data Center | 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 |
Version 1.1 required for retrieval time. The API version you want to use. Supported versions:
See Stateless and Stateful Modes for more information. |
|||||||
project |
Required for retrieval time. The project field contains the unique ID of a data integration project for a particular partner. It must be used together with "partner" field to uniquely identify a data integration target. |
|||||||
partner |
Required for retrieval time. The partner field indicates the unique ID of a data integration partner. 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 Salesforce.com, you can use partner as "Salesforce", and "project" as "00170000011K3Ub." Submit a request at Zuora Global Support to obtain a partner ID. |
|||||||
encrypted |
If enabled, you must supply the formatting (zip or unzip) first and decrypt it to get the actual contents. |
|||||||
offset |
This field specifies the time offset for AQuA queries in stateful mode. It is an integer in the range 0 to 3,600 seconds. The default value is zero. For example, if you set this field to 600 seconds and you post a query in stateful mode at 2:00 AM, it will query against data created or updated between the completion time of the previous query and 1:50 AM. The value of this field will override the value you configured in Settings > Administration > AQuA API Stateful Mode Time Offset. |
|||||||
queries |
A JSON Array object that contains a list of query objects. The list of query objects are name and query.
|
|||||||
name |
The name of the job. 32 character limit. |
Response Parameters
useLastCompletedJobQueries |
If this flag is set to true, then all the previous queries are merged with existing queries. |
|||||||||||||||
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. It must be used together with "partner" field to uniquely identify a data integration target. |
|||||||||||||||
partner |
The partner field indicates the unique ID of a data integration partner. 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 Salesforce.com, you can use partner as "Salesforce", and "project" as "00170000011K3Ub." 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:
|
|||||||||||||||
offset |
This field specifies the time offset for AQuA queries in stateful mode. It is an integer in the range 0 to 3,600 seconds. The default value is zero. For example, if you set this field to 600 seconds and you post a query in stateful mode at 2:00 AM, it will query against data created or updated between the completion time of the previous query and 1:50 AM. The value of this field will override the value you configured in Settings > Administration > AQuA API Stateful Mode Time Offset. |
|||||||||||||||
encrypted |
If enabled, you must supply the formatting (zip or unzip) first and decrypt it to get the actual contents. |
JSON Example
This example shows submitting a JSON request with offset
specified.
HTTP request:
POST https://www.zuora.com/apps/api/batch-query/
POST https://apisandbox.zuora.com/apps/api/batch-query/
JSON request:
{ "format":"CSV", "version":"1.1", "project": "aquatest64", "partner": "gooddata", "encrypted":"none", "offset": 600, "queries":[ { "name":"Account", "query":"select Id,CreditBalance,Name,Balance,TaxExemptStatus,AutoPay,Currency,PaymentGateway,PaymentTerm,SalesRepName,TaxExemptIssuingJurisdiction,TaxExemptEffectiveDate,TaxExemptExpirationDate,TaxExemptCertificateType,LastInvoiceDate,Status,TotalInvoiceBalance,CreatedDate,UpdatedDate, ParentId, CustomerServiceRepName from Account", "type":"zoql" } , { "name":"Subscription", "query": "select Id, AutoRenew, CancelledDate, ContractAcceptanceDate,ContractEffectiveDate, CreatedDate, InitialTerm, InvoiceOwnerId, IsInvoiceSeparate,Name, OriginalCreatedDate, RenewalTerm, ServiceActivationDate, Status, SubscriptionEndDate, SubscriptionStartDate, TermEndDate, TermStartDate, TermType,UpdatedDate, Version, PreviousSubscriptionId from Subscription", "type":"zoql" } ], "name":"DSEXPORT" }
Successful JSON response:
{ "useLastCompletedJobQueries": false, "batches": [ { "full": false, "name": "Account", "query": "select Id,CreditBalance,Name,Balance,TaxExemptStatus,AutoPay,Currency,PaymentGateway,PaymentTerm,SalesRepName,TaxExemptIssuingJurisdiction,TaxExemptEffectiveDate,TaxExemptExpirationDate,TaxExemptCertificateType,LastInvoiceDate,Status,TotalInvoiceBalance,CreatedDate,UpdatedDate, ParentId, CustomerServiceRepName from Account", "status": "pending", "recordCount": 0, "apiVersion": "65.0", "batchType": "zoql", "batchId": "2c9080214b08c3a0014b08f0a6d70042" }, { "full": false, "name": "Subscription", "query": "select Id, AutoRenew, CancelledDate, ContractAcceptanceDate,ContractEffectiveDate, CreatedDate, InitialTerm, InvoiceOwnerId, IsInvoiceSeparate,Name, OriginalCreatedDate, RenewalTerm, ServiceActivationDate, Status, SubscriptionEndDate, SubscriptionStartDate, TermEndDate, TermStartDate, TermType,UpdatedDate, Version, PreviousSubscriptionId from Subscription", "status": "pending", "recordCount": 0, "apiVersion": "65.0", "batchType": "zoql", "batchId": "2c9080214b08c3a0014b08f0a6d90043" } ], "project": "aquatest64", "partner": "gooddata", "name": "DSEXPORT", "id": "2c9080214b08c3a0014b08f0a6d50041", "version": "1.1", "format": "CSV", "status": "submitted", "offset": 600, "encrypted": "none" }