Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@marianogonzalez
Created May 25, 2018 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marianogonzalez/c6034a0032b3a1f48e7ae4127b6abe6e to your computer and use it in GitHub Desktop.
Save marianogonzalez/c6034a0032b3a1f48e7ae4127b6abe6e to your computer and use it in GitHub Desktop.
<flow name="getStockInfo">
<http:listener path="stock" method="GET" config-ref="httpListener">
<http:response>
<http:body>
<![CDATA[
%dw 2.0
output application/json
---
{
"ticker": attributes.queryParams.ticker,
"price": vars.price as Number,
"variation": vars.variation as Number
}
]]>
</http:body>
</http:response>
</http:listener>
<http:request path="price" config-ref="httpRequester" target="price">
<http:query-params>#[{'ticker': attributes.queryParams.ticker}]</http:query-params>
</http:request>
<http:request path="variation" config-ref="httpRequester" target="price">
<http:query-params>#[{'ticker': attributes.queryParams.ticker}]</http:query-params>
</http:request>
</flow>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment