Articles in this section

Build HTTP request body and Relative URI

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:

It would also be helpful to learn more about mapping your HTTP body parameters using JSON or XML.

Build your relative URI

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).

Review the Advanced field editor (AFE)

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.

4416934562075-Built_body_.png

Resources available for your handlebars template

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.

Click preview to evaluate your handlebars template

This provides a preview of the handlebars template, including all your populated fields.

Build your HTTP request body

In your HTTP import, scroll to find the HTTP request body field. Click Handlebars (pencil_handlebars.svg) on the right-hand side to open the Advanced field editor (AFE).

4416917458075-Request_body_blank_preview.png

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.

Was this article helpful?
1 out of 4 found this helpful

Comments

1 comment
Date Votes
  • It would be great to have some additional details here about AFE 1.0 vs AFE 2.0

    0

Please sign in to leave a comment.