Knowledge Center

Knowledge Center > API > Aggregate Query API (AQuA) > Post Query > Post Query with Retrieval Time

Post Query with Retrieval Time

This REST API can submit an aggregate query to retrieve those records that were either newly created or modified after a specified time, defined using the incrementalTime parameter. This can only be used in Stateful AQuA mode.

Request

POST https://www.zuora.com/apps/api/batch-query/

POST https://apisandbox.zuora.com/apps/api/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:

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

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.
Supported values are: pgp and none. 

incrementalTime

Allows you to override the time from which a Stateful AQuA job incrementally retrieves records that have been created or modified, using the incrementalTime parameter. For example, if you set incrementalTime = 2015-01-21 10:30:01, AQuA will retrieve records that have created or modified beginning at 10:30:02. If this parameter is not set, AQuA continues to use the Start Time of the last AQuA session to retrieve records incrementally.

The incrementalTime field does not support time zones, and it is always handled as in Pacific time zone. If in other time zones, convert the incrementalTime to Pacific time zone and then set the incrementalTime in AQuA request explicitly.

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.

query

A ZOQL query or Export ZOQL query. Values can be zoql or zoqlexport.

type

The job execution type. The value is always "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.
If the flag is set to false, then the previous queries are ignored, and only the new query is executed.

batches

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

full

Indicates a full or ncremental load. True = Full and False = Incremental.

name

The name of the job. 32 character limit.

query

A ZOQL query or Export ZOQL query. Values can be zoql or zoqlexport.

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.

recordCount

The actual number of records retrieved.

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

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.

batchType

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

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

incrementalTime

Allows you to override the time from which a Stateful AQuA job incrementally retrieves records that have been created or modified, using the incrementalTime parameter. For example, if you set incrementalTime = 2015-01-21 10:30:01, AQuA will retrieve records that have created or modified beginning at 10:30:02. If this parameter is not set, AQuA continues to use the Start Time of the last AQuA session to retrieve records incrementally.

The incrementalTime field does not support time zones, and it is always handled as in Pacific time zone. If in other time zones, convert the incrementalTime to Pacific time zone and then set the incrementalTime in AQuA request explicitly.

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

This example shows submitting a JSON request with the retrieval start time.

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",
 "incrementalTime": "2015-01-21 10:30:01",
"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",
    "incrementalTime": 1421865001000,
    "encrypted": "none"
}
Last modified
12:56, 15 Sep 2015

Tags

Classifications

(not set)