Use Data Query through API
Learn how to export data from your Zuora tenant through Data Query API.
You can use the Data Query API to submit queries, check the status of queries, and obtain the exported data.
-
Construct a SQL query.
SELECT accountnumber, balance FROM Account WHERE Account.balance > 100
For example: See Constructing SQL Queries in Data Query for the supported SQL syntax, the available tables, and sample queries. - Call Submit data query
to submit the query and create a query job. Provide the query in the request body.
You can request the query results in CSV, TSV, DSV or JSON format.
-
Call Get data query job
in the API or check your query listed on the Data Query page to track the status of the query job.
Depending on the complexity of the query, you may need to call "Get data query job" several times, until the value of
queryStatus
in the response body iscompleted
,failed
, orcancelled
.When the query job is complete, you can obtain the URL of the query results from the response body. For example:https://example.s3.us-west-2.amazonaws.com/3a3e85c4-96e7-486b-ae02-827120104301_24921638725108715.json?X-Amz-Security-Token=...
- Download the query results.
Each row in the query results contains the requested fields of an object in your Zuora tenant. For example:
If you requested the query results in JSON format, each row in the query results is a JSON object. The query results are not wrapped in a JSON array. For example:
accountnumber,balance A00253588,230.0 A00253573,125.0 A00255366,199.95 ...
{"accountnumber":"A00253588","balance":230.0} {"accountnumber":"A00253573","balance":125.0} {"accountnumber":"A00255366","balance":199.95} ...