Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <mule
- xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
- 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/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
- <http:listener-config name="HTTP_Listener_config_test" doc:name="HTTP Listener config" doc:id="1909e2a5-79c7-4206-aa2e-b8df68f5e133" >
- <http:listener-connection host="0.0.0.0" port="8090" />
- </http:listener-config>
- <http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="17198395-4ca4-4b2c-b474-5a842d68a1e6" >
- <http:listener-connection host="0.0.0.0" port="8081" />
- </http:listener-config>
- <http:request-config name="HTTP_Request_configuration" doc:name="HTTP Request configuration" doc:id="54a87666-ec11-4714-b2d4-1f2a1d403b14" >
- <http:request-connection host="jsonplaceholder.typicode.com" />
- </http:request-config>
- <flow name="External-GETFlow" doc:id="7f5a5c71-3a7f-46aa-b436-9bb37d7254be" >
- <http:listener doc:name="Listener" doc:id="9167eb7d-ed87-475f-b733-764a21576fa8" config-ref="HTTP_Listener_config" path="/todo/{id}" allowedMethods="GET"/>
- <http:request doc:name="Request" doc:id="0abe5435-8d6b-4eb2-9c15-0977f2e730af" config-ref="HTTP_Request_configuration" url="https://jsonplaceholder.typicode.com/todos/#[attributes.uriParams.id]" outputMimeType="application/json" method="GET"/>
- <logger level="INFO" doc:name="Logger uriParams" doc:id="21397b93-aa9d-4f7f-a1ee-7dfb8627ebb6" message="#[attributes.uriParams]"/>
- <logger level="INFO" doc:name="Logger QueryParams" doc:id="097ab03a-d084-4b67-9c02-f53ebea33fdc" message="#[attributes.queryParams]"/>
- <ee:transform doc:name="Transform Message" doc:id="8a332f75-9f5e-4c08-abb8-9169a07d32f7">
- <ee:message>
- <ee:set-payload>
- <![CDATA[%dw 2.0
- output application/json
- var id = (attributes.uriParams.id default 0) as Number
- var todo = (payload filter (item) -> item.id == id)[0] default {}
- ---
- {
- "questo รจ il mio uri": id,
- "questo รจ il mio query": attributes.queryParams.completed,
- "idAPI": todo.id,
- "titleAPI": todo.title,
- "completedAPI": todo.completed
- }
- ]]>
- </ee:set-payload>
- </ee:message>
- </ee:transform>
- </flow>
- </mule>
Advertisement
Add Comment
Please, Sign In to add comment