The HTTP request body defines the data you send to your destination application. You do not need to build a request body for your HTTP imports. If you set this field, the data is sent to the destination application as you wrote it. If you don’t, the data from the last flow step is sent to the destination application in the HTTP request body.
Caution
You don’t need to configure an HTTP request body, but if you do, it will modify the way your data is sent to the destination application. Building the request body is only necessary if you have an HTTP import.
To create your relative URI and request body you’ll need:
-
a sample request from your application’s API
-
a basic understanding of XML or JSON
-
familiarity with handlebars expressions
-
a flow, including a source and mapped field records
It would also be helpful to learn more about mapping your HTTP body parameters using JSON or XML.
The relative URI is the resource path portion of an API endpoint. Some examples are: /product
or /bulkUpdate/orders
. This value is combined with the base URI defined in the connection resource associated with your import. The base URI and relative URI complete a fully qualified URL describing an API endpoint.
Note
When modifying the relative URI and headers, the input data is raw or is the output of a preMap script (if one was used).
The Advanced field editor (AFE) is a user interface available for certain fields where the output is generated using dynamic data, like creating an HTTP request body with handlebars expressions.
Note
After an import is mapped or the postMap script is executed, the data available in the AFE is the data that’s been mapped or manipulated by the script.
This section displays your available fields, example data, and connection details. You must manually add additional fields and example data, including any fields used in field mappings. You can also use Create lookups to dynamically retrieve information from the destination application.
In your HTTP import, scroll to find the HTTP request body field. Click Handlebars () on the right-hand side to open the Advanced field editor (AFE).
The best option for building a request body is to paste an example request from your destination application’s API and add your handlebars expressions. You can use import mappings to associate fields; for example, a "Purchaser" field in a source application would correspond to a "Person" field in the destination application. The sample JSON data below is taken from the source application:
{ "Group1": { "Shopper1": [ { "Purchaser":"Human", "Email":"email.at.email.com", "Name":"JohnSmith" } ] } }
This source application data can be directly mapped to a destination application. Notice the difference between the field names where Purchaser
in the source application is Person
in the destination application:
{{#each people}} { "{{Customer1}}": { "{{Person}}", "{{BuyerEmail}}", {{BuyerName}}" }
…and so on. You don’t need to create associations in your handlebars expressions because they’ve already been created in your field mappings.
Once you’ve written your HTTP request body, use Preview to evaluate the template and finish your body. Then, Save and close your import.
Comments
It would be great to have some additional details here about AFE 1.0 vs AFE 2.0
Please sign in to leave a comment.