Contact Free trial Login

Zuora Examples - Mule 4

Example: Retrieve Details for an Account

This example retrieves the account details for the specified account ID and returns them in JSON format.

Studio Flows

  • Listener (HTTP) - Accepts data from HTTP requests.

  • Zuora API Connector - Connects with Zuora and executes a query to retrieve the account details for the specified account ID.

  • Transform message - Outputs the results of the Get account operation in JSON format.

    studio_use_case

XML Flows

Paste this XML code into Anypoint Studio to experiment with the flow described in the previous section.

<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:zuora-connector="http://www.mulesoft.org/schema/mule/zuora-connector"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http
http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/zuora-connector
http://www.mulesoft.org/schema/mule/zuora-connector/current/mule-zuora-connector.xsd
http://www.mulesoft.org/schema/mule/ee/core
http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
	<http:listener-config name="HTTP_Listener_config"
	doc:name="HTTP Listener config">
		<http:listener-connection host="localhost" port="8081" />
	</http:listener-config>
	<zuora-connector:config name="Zuora_Connector_Config"
	doc:name="Zuora Connector Config"
	property_basePath="/rest"
	property_username="${zuora.username}"
	property_password="${zuora.password}"
	property_host="apisandbox-api.zuora.com" />
	<flow name="zuora-demo-testFlow">
		<http:listener doc:name="Listener"
		config-ref="HTTP_Listener_config" path="/getAccount"/>
		<zuora-connector:get-account doc:name="Get account"
		config-ref="Zuora_Connector_Config" account-key="#[payload]"/>
		<ee:transform doc:name="Transform Message">
			<ee:message >
				<ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
payload]]></ee:set-payload>
			</ee:message>
		</ee:transform>
	</flow>
</mule>

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.