SOAP and JSON Payload Formatting

When working with API’s you may come across multiple different posting types, some of which require a specific format or “schema” for the body of the record for them to properly deliver. These posting types require the use of the “SOAP/HTML Payload” located at the bottom of the campaign. Depending on the documentation the campaigns will utilize primarily an XML or JSON format when posting the leads and require the data fields to be mapped within the payload section for the data to be drawn dynamically from the leads within your system.

Our system utilizes a double bracket method that tells the code which Parameter Name to draw data from in the data mapping section.

{{ParameterName}}

Here are some examples of what a payload may look like:

Example JSON Payload

{
“apikey”:”{{apikey}}”,
“firstName”:”{{firstname}}”,
“lastName”:”{{lastname}}”,
“address”:{
“address1″:”{{address1}}”,
“zip”:”{{zip}}”
},
“phone”:”{{phone1}}”
}

Example XML/SOAP Payload


<?xml version=”1.0″ encoding=”utf-8″?>
<soap:Envelope xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:soap=”http://schemas.xmlsoap.org/soap/envelope/”>
<soap:Body>
<ExampleSoap>
<apikey>{{apikey}}</apikey>
<firstName>{{firstName}}</firstName>
<lastName>{{lastName}}</lastName>
<address>{{address1}}</address>
<city>{{city}}</city>
<state>{{state}}</state>
<zip>{{zip}}</zip>
<phone>{{phone1}}</phone>
</ExampleSoap>
</soap:Body>
</soap:Envelope>

Typically, API documentation will provide examples of the format which you may copy and replace your respective Parameter Name values with for the leads to pass properly. Additionally there are many great resources out there to help check and ensure that your JSON or XML is in the proper format.

For additional JSON and XML formatting help visit one of the website below:
https://jsonformatter.curiousconcept.com/
https://www.freeformatter.com/