Join this session to learn more about Zuora's object model, data sources, AQuA and Reporting APIs. Developers will learn how to use the Rest APIs for AQuA Queries and for managing report templates in the new reporting engine.
6. Synchronous vs Asynchronous Queries
page
06
Synchronous
• You submit the query
• The query results are included in the API response
• Good for small amounts of data needed quickly
Asynchronous
• You submit the query
• Query is queued for processing & Job ID returned in API response
• You submit another API call to check the Job ID’s status (or wait to
receive a callout notification)
• If job status is complete, you submit an API call to download the
result file.
• Good for large amounts of data that is not urgent.
12. ZOQL & Export ZOQL
page
012
Zuora’s Object Query Language:
select field_names from object where filter_statements
Export ZOQL
select Product.Name as Product,
ChargeAmount,
RatePlanCharge.Description,
RatePlanCharge.Name,
RatePlanCharge.ChargeNumber,
RatePlanCharge.ChargeType,
Invoice.Id, Invoice.InvoiceNumber, Account.*
from InvoiceItem
where Invoice.Id =
'2c92c0945bae44c0015bc6f50daa6729'
order by Product.Name asc
ZOQL
select ProductName,
ChargeAmount,
ChargeDescription,
ChargeName,
ChargeNumber,
ChargeType,
InvoiceId
from InvoiceItem
where InvoiceId =
'2c92c0945bae44c0015bc6f50daa6729’
13. pros & cons
ZOQL
page
013
conspros
Fast Synchronous Operations
Data is from the Transactional Database
No Complex Queries or DataSource
Joining
No Aggregate Functions
No Wild Card Support
No Order By or Limit Support
Only 2000 maximum records returned
No Parenthesis to indicate order of
operation
Response Data is in JSON
14. pros & cons
Export ZOQL
page
014
conspros
Complex Queries with DataSource Joins
Aggregate Functions & Wildcard Support
Only used in Asynchronous Queries
2047 MB File size
Query can be 20,000 characters
Column Aliases, Order by and Limit
Support
Parenthesis indicate order of operation
Data delays could occur in Replication
Database
No JSON Data – You have to parse CSV
files
19. pros & cons
ZOQL
page
019
conspros
Fast Synchronous Operations
Data is from the Transactional Database
No Complex Queries or DataSource
Joining
No Aggregate Functions
No Wild Card Support
No Order By or Limit Support
Only 2000 maximum records returned
No Parenthesis to indicate order of
operation
Response Data is in JSON
22. Synchronous Query Examples: Using AND &
OR
page
022
select
ProductName, ChargeAmount, ChargeDescription, ChargeName,
ChargeNumber, ChargeType, InvoiceId
from InvoiceItem
where
InvoiceId = '2c92c0945bae44c0015bc6f50daa6729’
or
InvoiceId = '2c92c0955c205714015c31b6753f6922’
and ChargeAmount >= '10’ "
23. Synchronous Query Examples: Using AND &
OR
page
023
select
ProductName, ChargeAmount, ChargeDescription, ChargeName,
ChargeNumber, ChargeType, InvoiceId
from InvoiceItem
where
InvoiceId = '2c92c0945bae44c0015bc6f50daa6729’
and ChargeAmount >= '10'
or
InvoiceId = '2c92c0955c205714015c31b6753f6922’
and ChargeAmount >= '10’ "
24. Synchronous Query Examples: AND Takes Precedence
Over OR
page
024
select
ProductName, ChargeAmount, ChargeDescription, ChargeName,
ChargeNumber, ChargeType, InvoiceId
from InvoiceItem
where
(InvoiceId = '2c92c0945bae44c0015bc6f50daa6729’
and ChargeAmount >= '10' )
or
(InvoiceId = '2c92c0955c205714015c31b6753f6922’
and ChargeAmount >= '10’)"
27. DataSource Exports and AQuA
page
027
Exports
• Allows for output in CSV and Excel Format (can be zipped)
• Allows for data to be encrypted
• Event Callout Notification Upon Completion
AQuA – Aggregate Query API
• Allows for output only in CSV Format (can be zipped)
• Using Stateful queries allow for:
• Exporting data that was last updated since the last query.
• Exporting Deleted Objects since the last query
• AQuA results older than 72 hours are purged automatically
• Allows for data to be encrypted
• Event Callout Notification Upon Completion
28. Export Query - Details
page
028
{
"objects": [
{
"Format": ”excel",
"Name": "My excelExport",
"Query": "select Product.Name, ChargeAmount,
RatePlanCharge.Description, RatePlanCharge.Name,
RatePlanCharge.ChargeNumber, RatePlanCharge.ChargeType, Invoice.Id,
Invoice.InvoiceNumber from InvoiceItem where Invoice.Id =
'2c92c0945bae44c0015bc6f50daa6729' order by Product.Name asc"
}
],
"type": "Export"
}
31. Export Query Example using Actions - Review
page
031
POST {{RestEndPoint}}/v1/connections
POST {{RestEndPoint}}/v1/action/create
POST {{RestEndPoint}}/v1/action/query
GET {{UI_EndPoint}}/apps/api/file/{{file_id}}
33. Export Query Example using Object/Export-
Review
page
033
POST {{RestEndPoint}}/v1/connections
POST {{RestEndPoint}}/v1/object/export
GET {{RestEndPoint}}/v1/object/export/{{job_id}}
GET {{RestEndPoint}}/v1/files/{{file_id}}
35. AQuA Query - Review
page
035
POST {{RestEndPoint}}/v1/connections
POST {{UI_EndPoint}}/apps/api/batch-query/
GET {{UI_EndPoint}}/apps/api/batch-query/{{job_id}}
GET {{UI_EndPoint}}/apps/api/file/{{file_id}}
37. Reports API
page
037
• Get Last Completed Report Run
• Get Report Data
• Export Report Run
• Run a Report
• Cancel a Report Run
• Search by Report Name
• Get Reports by Label
• Get Report Details
• Get Report by ID
• Get Report Details by Label
• Copy a Report and Assign Labels
• Get Report Labels for ReportID
• Create a Report and Assign Labels
• Delete a Report
• Label or Unlabel a Report
• Save a Report
• Get Tenant Settings
• Update Tenant Settings
38. Reports API – Sequences for Migrating a report template
page
038
Export Report with ID
1) Log into Source ZConnect/ZConnectSandbox
2) Get report details based on report ID
3) Deserialize the definition
4) Write the file
Import Report
1) Log into Target ZConnect/ZConnectSandbox
2) Serialize the definition from the report JSON file
3) Query the report to see if it already exists and use existing report ID
4) Post Report