Knowledge Center

Knowledge Center > API > Aggregate Query API (AQuA) > File Segmentation

File Segmentation

File segmentation allows tenants with thousands of records in the database to retrieve data in multiple files instead of one large file. File segmentation can only be performed in Stateful mode, and only for the initial load of the Stateful AQuA job. It is a two phase data pull from the servers that are executed in parallel.

Requirements

You must have AQUA File Segmentation enabled. Submit a request with Zuora Global Support for assistance.

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

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.

 

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

 
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 useQueryLabels to true so that API names remain the same.

By default useQueryLabels is false, so that output CSV headers display the more user-friendly object and field labels. 

 

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

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

 

queries

A JSON Array object that contains a list of query objects. The list of query objects are name and query.

name

The query name that can uniquely identify the query in this API request

query

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

type

The query type. The supported values are zoql and zoqlexport.

deleted

This indicates that the AQuA incremental load will retrieve deleted records.

column

Name of the Column in the extracted file that points to the deleted records. 

format

Can be set to either “Numeric” or “Boolean.” If set to Numeric, deleted records are marked as 1. If set to Boolean, deleted records are marked as “true.”

 

 

 

Response Parameters

batches

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

deleted

This indicates that the AQuA incremental load will retrieve deleted records.

column

Name of the Column in the extracted file that points to the deleted records. 

format

Can be set to either “Numeric” or “Boolean.” If set to Numeric, deleted records are marked as 1. If set to Boolean, deleted records are marked as “true.”

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.

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

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.

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.

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.
  • Pending: The job is extracting data from the database.

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

In this example, each file segment will either be 500 MB in size or 500k records, depending which is reached first.

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",
    "name": "Example",
    "encrypted": "none",
    "useQueryLabels" : "true",
    "partner": "salesforce",
    "project": "00170000011K3Ub",
    "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, BillToContact.Id, SoldToContact.Id  from  Account",
            "type": "zoqlexport",
            "deleted": {
                "column": "Deleted",
                "format": "Boolean"
            }
        }
    ]
}
JSON response:
{
    "batches": [
        {
            "deleted": {
                "column": "Deleted",
                "format": "Boolean"
            },
            "full": true,
            "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, BillToContact.Id, SoldToContact.Id  from  Account",
            "status": "pending",
            "recordCount": 0,
            "apiVersion": "60.0",
            "batchType": "zoqlexport",
            "batchId": "402881824835bb2a0148419305d602a7"
        }
    ],
    "project": "00170000011K3Ub",
    "partner": "salesforce",
    "name": "Example",
    "id": "402881824835bb2a0148419305d402a6",
    "version": "1.1",
    "format": "CSV",
    "status": "submitted",
    "encrypted": "none"
}

HTTP request:

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

JSON response:

{
    "batches": [
        {
            "deleted": {
                "column": "Deleted",
                "format": "Boolean"
            },
            "full": true,
            "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, BillToContact.Id, SoldToContact.Id  from  Account",
            "status": "completed",
            "recordCount": 88,
            "apiVersion": "60.0",
            "batchType": "zoqlexport",
            "batchId": "402881824835bb2a0148419305d602a7",
            "segments": [
                "402881824835bb2a01484193065e02ab",
                "402881824835bb2a01484193066602ac",
                "402881824835bb2a01484193066e02ad",
                "402881824835bb2a01484193067602ae",
                "402881824835bb2a01484193067f02af",
                "402881824835bb2a01484193068602b0",
                "402881824835bb2a01484193068e02b1",
                "402881824835bb2a01484193069502b2",
                "402881824835bb2a01484193069c02b3",
                "402881824835bb2a0148419306a202b4",
                "402881824835bb2a0148419306a902b5",
                "402881824835bb2a0148419306b102b6",
                "402881824835bb2a0148419306b802b7",
                "402881824835bb2a0148419306bf02b8",
                "402881824835bb2a0148419306c502b9",
                "402881824835bb2a0148419306cc02ba",
                "402881824835bb2a0148419306d302bb",
                "402881824835bb2a0148419306d902bc"
            ]
        }
    ],
    "project": "00170000011K3Ub",
    "partner": "salesforce",
    "name": "Example",
    "id": "402881824835bb2a0148419305d402a6",
    "version": "1.1",
    "format": "CSV",
    "startTime": "2014-09-04 09:50:27",
    "status": "completed",
    "encrypted": "none"
}
Last modified
11:11, 16 Dec 2015

Tags

Classifications

(not set)