How to map an object inside an array into an http api post?

I am trying to do an upsert all of my accounts between airtable and salesloft using the search function of airtable and the http module.

I can’t figure out how to properly map an object - “custom_fields” inside the http module. All of the other fields map work properly when i do them one by one, but I can’t figure out how to get the custom fields to work.

Any help is appreciated as this is something I need to understand how to do!

Here is the info I am looking to map, and it works great other than the custom fields.
{
name: {{3.business_name}},
phone: {{3.business_phone}},
website: https://salesloft.com,
street: {{3.business_address_01}} {{3.business_address_02}},
city: {{3.business_city}},
state: {{3.business_state}},
postal_code: {{3.business_zip}},
country: {{3.business_country}},
description: {{3.company_description}},
“domain: {{3.domain}},
company_type: Private,
upsert_key: “id”,
id: {{3.salesloft_account_id}},
custom_fields: {
company_stage_id: {{3.salesloft_stage_id}},
airtable_id: {{3.id}}
}
}



Salesloft API:

The current problem is not with your custom fields but rather the JSON that you are passing is not valid, You need to wrap the keys in double-quotes plus you need to wrap the values in doublequotes as well.

Plus the JSON doesn’t look valid as it is missing closing parenthesis. Not sure if the format you are using is correct, but based on the API doc you shared, you need to pass it like this,’

 {   "name": "Hogwarts School of Witchcraft and Wizardry",
     ......
    "custom_fields": {
      "MyField": "A Value",
      "Other": "Field"
    }
}

Also, From the document the accepted content-type is multipart/form-data. So, Can you share what you are getting as the response for the success when you are passing the requested content without the custom fields. As, For multipart-formdata the data needs to be passed as key values instead of JSON.

1 Like