Generating XML from a Form Submission so that it can posted to a 3rd party
Posting data to a 3rd party can be done with our flexible HTTP POST wizard or with Web Hooks. These guide provides a couple of examples if generating XML from a form submission so that it can be posted to a 3rd Party
There are a couple of ways you can generate XML and post it to a 3rd party. These 2 methods are explained below.
1. Using Bindings on the form in a hidden textarea to manually build the XML:
/hc/en-us/articles/208079266-String-Concatenation
This depends on your XML needs. You could write a bindings that wrote the XML to a textarea field element like this in the binding:
'<application xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' + 'id="5aa69470-d09d-4db2-8f8f-b172667a5732" timestamp="2018-07-30T10:03:42" type="Full" startdate="2018-07-30" ' + 'version="2.00" adcode="OL2018" businesssource="Compare the Market(Offline)">' + '<covertypes>' + '<cover type="'+[type]+'" subtype="None" term="'+[term]+'" amount="'+[amount]+'" indexation="Level" />'+ '</covertypes>'
That was just a small sample of the XML. You can also use conditional logic to build something more advanced /hc/en-us/articles/208079356-Writing-Conditional-Statements
2. Using a webhook to build and send the XML
This option requires webhooks to be enabled (they are not enabled by default) and is an Enterprise Plan feature.
/hc/en-us/articles/211560243-Web-Hooks-Overview
/hc/en-us/articles/210111666-Web-Hooks-Making-Remote-API-Calls
Documentation for Needle, for making remoting calls, can be found here:
https://github.com/tomas/needle/blob/master/README.md
And the xml2js library is also available when writing web hooks, documentation can be found here:
https://www.npmjs.com/package/xml2js
0 Comments