Zuora Query

Zuora Query

With the Zuora Query function, you can send query operations to Zuora Billing and retrieve the response for further enrichment. This enrichment can provide more context and details to the subscription billing data, enabling deeper insights, improving decision-making, and enabling more efficient operations. Enriched data from the Zuora Query function can be passed down for further processing by the next function in the stream.

The function sends requests using the POST method and then receives the responses, which are routed to the next function in the stream. This function supports two APIs https://knowledgecenter.zuora.com/Zuora_Central_Platform/Query/Data_Query and https://knowledgecenter.zuora.com/Zuora_Central_Platform/Query/ZOQL.

You can configure the function by entering the following details:

Settings

functioneditor.png
The function editor of Zuora Query

Setting

Description

Setting

Description

Environment

Tenant

Select the Zuora environment. The following endpoints are available for selection:

  • US DC1 Production: https://rest.na.zuora.com/

  • US DC2 Production: https://rest.zuora.com/

  • US DC1 API Sandbox: https://rest.sandbox.na.zuora.com/

  • US DC2 API Sandbox: https://rest.apisandbox.zuora.com/

  • US Central Sandbox: https://rest.test.zuora.com/

  • EU Production: https://rest.eu.zuora.com/

  • EU Sandbox: https://rest.sandbox.eu.zuora.com/

  • EU Central Sandbox: https://rest.test.eu.zuora.com/

  • Custom: Use this option to access your own custom tenant environment. Specify the URL for your endpoint.

Credentials

Select from secrets wallet

To select a predefined Zuora secret from your Secrets wallet, turn on the Secrets wallet toggle.

Authentication by

Note!

This option only appears Secrets wallet toggle is disabled.

Select how you want to perform authentication. You can select either authentication method:

  • OAuth 2.0

  • API key

Client ID

Note!

This option only appears Secrets wallet toggle is disabled, and the OAuth 2.0 authentication method is selected for the Authentication by option.

Enter the client ID that is displayed when the OAuth client is created in Zuora. 

Client secret

Note!

This option only appears Secrets wallet toggle is disabled, and the OAuth 2.0 authentication method is selected for the Authentication by option.

Enter the client secret ID that is displayed when the OAuth client is created in Zuora.

Access key ID

Note!

This option only appears Secrets wallet toggle is disabled, and the API key authentication method is selected for the Authentication by option.

Enter the identifier that is used to sign the requests sent to Zuora. It is displayed when the API User is created in Zuora.

Secret access key

Note!

This option only appears Secrets wallet toggle is disabled, and the API key authentication method is selected for the Authentication by option.

Enter the key that is used along with the Access key ID to cryptographically sign the Zuora requests.

Entity

Multi-entity

If you have Zuora Multi-entity enabled, specify the name of the Multi-entity you want to access. With Zuora Mulity-entity, you can create and manage multiple entities within a single Zuora tenant, see https://knowledgecenter.zuora.com/Billing/Tenant_Management/Multi-entity  for more information.

Note!

When you enter content in the Multi-entity field, you can use variable insertion (interpolation). For details, see Variable insertion.

Query

Use data query

Select if you want to write your queries as Data Query or ZOQL. By default, the queries use the Data Query language. To perform queries using ZOQL, turn off the Use data query toggle. You can access the Zuora API using the following endpoints:

  • Data Query - Zuora endpoint is POST to /query/jobs

  • ZOQL - Zuora endpoint is POST to/v1/action/query.

Note!

When the Use data query toggle is turned on and a status 200 is received from Zuora, but the query fails, the result can be captured with the Action on error setting:

  • If you select Ignore, the system attaches the errorMessage and errorCode to the payload, allowing the process to continue while still capturing the error details.

  • If you select Stop the stream, the system throws an error message and displays it in the logs.

Query body

Enter the body of the query.

Note!

When you enter content in the Query body field, you can use variable insertion (interpolation). For details, see Variable insertion.

Use Index Join

Note!

This option only appears when the Use data query toggle is enabled.

Check the Use Index Join check box to enable Index Join to speed up retrieving data from multiple tables. See Zuora’s Index JOIN for more information.

Result key

Enter a custom result key to be included in the query output. The default result key is 'ZuoraQueryResponse'.

Enable result headers

Select the check box to add a header to the response in the Result headers key field. The default result headers key is 'ZuoraQueryResponseHeaders'.

Enable result headers.png
Enable result headers configuration

Cache settings

Enable cache

To enable the caching of items, turn on the Enable cache toggle. Here, an item refers to the response to a query. Specify the maximum number of items you wish to store in the cache and the time (in seconds) after which the items are removed.  An item is removed from the cache in case either the maximum number of items is reached, or if an item is stored for more than the defined duration.

Cache settings.png
Cache settings configuration

Operational settings

Wait for job completion for maximum

Enter the wait time duration for the query job’s final state. Once a query is submitted to the Zuora tenant, the job will be retried repeatedly every second until a final response is received, or the defined wait time duration is reached. If no final state is received within the specified time period of the query job, the stream execution will be aborted. The maximum value allowed is 3600 seconds.

Action on error

Select the action you want to take in case of an error, the options are:

  • Ignore

  • Stop the stream

Any response with the HTTP status code 4xx or 5xx is considered an error. All errors get logged in the system logs. See Logs for more information.

The default value is Ignore.

Note!

If you click Preview, only a maximum of five records will be displayed. However, during the actual execution of the stream, the entire result will be displayed.

Input/Output data

Input data

None.

Output data

Output data.png
Query response from Zuora

Below is a sample output data:

[ { "value": 1, "ZuoraQueryResponse": [ { "Product Charge": "Annual User Charge" }, { "Product Charge": "CloudStream Power Supply" }, { "Product Charge": "Monthly User Charge" }, { "Product Charge": "t2.medium Usage Charge" }, { "Product Charge": "Professional Services Fixed Bid" } ] } ]