HTTP REST Request Action : JSON, XML, or Raw HTTP?
Determining the rules that will structure the data you will be receiving
Data received from an API call can come in different structures. The most common, and widely adopted standard is the JSON format. When making a HTTP call using Workato, by providing a sample JSON response, Workato is able to work out the structure of the API call, and creates Data Pills to be used in your recipe in later sections.
XML or JSON?
XML is a general language that is commonly used in the internet. One good way to spot a sample XML response is by identify XML tags. XML tags often look like this :
<job> <Name>Adam</name> <Company>Workato</company> </job>
In plain English, you can read this as : A Job object has a Name and a Company. The Name of the Job is called Adam, and the Company of the Job is called Workato. In XML Format, each field has an opening tag ( <job> ) and a closing tag </job> . Anything in between would be the value that that the tag holds.
Meanwhile, here is an example of how JSON data looks like
{ "Job": { "Name" : "Adam", "Company" : "Workato" } }
A JSON representation is similar to XML, but with its own set of rules. A JSON object is represented by its opening and closing curly brackets. The first value before the colon would be the Object or fields' Name, and the right hand side of the colon would represent its value.
The main diference of these two data formats are only how they are actually formatted. Data usually stays the same.
An example of a comparison between XML and JSON
Here's a sample of an API with its endpoint's sample response type :
Based on our previous understanding, we can know that the response data is in JSON format.
RAW HTTP
Instead of letting Workato parse the given response data, you can also opt for getting the raw input response. This is useful when data pills are not needed from the sample response, and only a simple line of response data will be received. When chosen this option, A data pill call Body will be available instead of the provided structure with each field as a data pill.