We are trying to create an endpoint policy that converts the SOAP response to json, based on the response (200 or any other error response like 500)
Unfortunately we are unable to get the if/else working.
So as an alternative we tried using with.. else... This works. But unfortunately it only works for 200 and the rest of the response do not work.
It would be of great help, If anyone could help with a sample of handlebars "if.. else.. "
Any suggestion towards the right direction would help.
Note - We are using "API Flows" to merge multiple APIs in a single flow. Hence the requirement of converting the soap to json using endpoint policy
Below is the sample code
<jsonTransform continueOnError="false" displayName="JSON transform Policy-example"
enabled="true" name="JSON-Tranform-example" version="1.0"
xmlns="http://www.infor.com/ion/api"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.infor.com/ion/api jsonTransform.xsd">
<transformations>
<transform kind="handlebars" outputType="text/xml;charset=UTF-8">
<![CDATA[
{{#with soapenv:Envelope.soapenv:Body.ns1:MP0666_GetUserOrganization_001_Result.ns1:ResultData.ns2:UserOrganization.recordid as |recordID|}}
{{recordID}}
{{else}}
No Record
{{/with}}
]]>
</transform>
</transformations>
</jsonTransform>