HOW TO: Use handlebars to pass the value of a variable in an array as part of the Relative URI

Courtney Jordan
Thu, 30 Jul 2020 22:36:17 +0000
Integrator.io

In this scenario, you need to pass the value of a variable in an array. You have 3 items in your array and would like to send the product as part of the Relative URI

{
 "Data":
 [
   {
    "product": "bikes"
   },
   {
    "product": "snowboards"
   },
   {
    "product": "skis"
   }
 ]
}

If you’re using our beta UI:

1. Choose Yes (Advanced) on the One to many field.

2. Define the Path to many as “Data”. This will inform your handlebar expressions to read from properties in the objects of the array that you’ve defined, in this case, “Data”.

3. In the Relative URI field, you can reference the fields in the objects from the “Data” array directly as if they were on the root path, such as

/api/abccompany/v1/products/{{product}}

You may also need to adjust your HTTP request template and use the JSON pathing above.

If you’re using our current UI:

1. Choose Yes (Advanced) from the Does each individual record being processed translate to multiple records in the import application? Option.

2. In the Relative URI field, type the code above.

1 post - 1 participant