Zuora has been offering three different types of API: REST API, SOAP API and AQuA API. It is believed that majority of Zuora customers use the SOAP API to integrate with Zuora because of the breadth of its API. (MuleSoft is using the SOAP API internally!) While MuleSoft offered the Zuora Connector based on SOAP API, we started to hear from customers that some tasks could be done easily with AQuA API and Zuora is starting to recommend that customers use the AQuA API instead. To support this trend, we are excited to announce the release of Zuora Connector v3.1.0.
For those who are not familiar with AQuA API, it stands for Aggregate Query API. The AQuA API offers a easier way to send multiple queries to Zuora and retrieve results of the queries as files or segments of files. One caveat here is that all the queries may not be completed at the same time, and the user will need to call Zuora periodically to check the status of the queries. We thought the experience around this could be better, and wanted to build a connector that addressed some of these limitations. So instead of relying on Studio to check the status of the queries (which is a fine method since the connector supports the AQuA API), our recommended approach is that users put the job in object store and let the connector return the file ID with the results of the queries once the job is finished.
In this blog post, I will walk you through a demo app to show how to use the AQuA API with the Zuora Connector. Before you start with the demo app, please make sure you have the Zuora Connector v3.1.0 downloaded from the Exchange.
After you install the Zuora Connector, load this demo app called zuora-aqua-api-operations-demo. This blog post will focus on the last two flows of that Mule application.
Once you load the example, let’s configure the connector. To configure the Zuora Connector, go to Global Elements, and find “Zuora.” After selecting “Zuora,” click “Edit”.
In the “Zuora: Configuration”, you can specify the configuration for Zuora. You could directly add your Zuora information in the configuration, but we recommend using the properties file to add your configuration information. In mule-app.properties, please configure the following properties based on your Zuora instance.
config.username=
config.password=
config.endpoint= (i.e. https://apisandbox.zuora.com/apps/services/a/75.0 )
config.restEndpoint= (i.e. https://apisandbox.zuora.com/apps/api/)
config.wsdlLocation= (Please locate your Zuora WSDL. You might need to download a WSDL file from Zuora.)
After you complete the configuration for your Zuora environment, run the app. When you open up a browser and hit localhost:8081, your browser will show the following page. Please click on Post Query Results to Object Store.
The Post Query Results to Object Store form allows you to send two queries: one for Export Zuora Object Query Language (ZOQL) and the other for ZOQL in one job. For this demo, the following queries have been used:
- SELECT name,Currency,Status FROM Account WHERE name=’Name Test for PostQuery’ in ExportZOQL Query
- SELECT AccountId FROM Invoice in ZOQL Query
When you go back to Studio and check the folder (src/test/resources), you will find the following two files in less than a minute.
2c92c08557ff9b2e01580215bf9832e5 includes the results of SELECT AccountId FROM Invoice in ZOQL Query.
4028e6963424ef6001342503xxxx
4028e69734172d4f01341fd11xxxx
2c92c0f83b02a9dc013b05d1dxxxx
2c92c0f83b02a9dc013b05d1d3xxxx
2c92c0f83b02a9dc013b05d1d5xxxx
2c92c0f83b02a9dc013b05d1d7xxxx
2c92c0f83b02a9dc013b05d1d9xxxx
2c92c08557ff9b2e01580215bfe632e6 includes the results of SELECT name,Currency,Status FROM Account WHERE name=’Name Test for PostQuery’ in ExportZOQL Query.
Account: Name,Account: Currency,Account: Status
Name Test for PostQuery,USD,Draft
Name Test For PostQuery,USD,Draft
Name Test for PostQuery,USD,Draft
Name Test For PostQuery,USD,Draft
Let me briefly explain how I retrieved these two files. As you can see below, when “Save Job to Object Store” is checked, the Post Query Response with id and batchid(s) is stored in Object Store (in the demo, it will be stored in PostQueryResultsStore.)
In the following flow, the Zuora Connector in Source checks the status of my job with the Post Query Response stored in PostQueryResultsStore by calling Zuora periodically (i.e. every second). Once the job is completed, the rest of the flow continues, and the Zuora Connector with “Get Export File Stream” retrieves a file for each query.
For new users, try the above example to get started, and for others, please share with us how you are planning to use the Zuora Connector! Also, explore the Anypoint Exchange to see other resources you can leverage today.