Pass nested arrays in API Connector with Form-data

Here is my solution for passing nested structures via API connector with Form-data because I’ve not found this in the forum and struggled a lot.

Initial situation

Field with nested array for multiple options. In my case it was a section for ‘custom_fields’.
To create or edit the external system, I’ve to pass the field_id and the value like in the API documentation of the external system mentioned.

“custom_fields”: [
{
“field_id”: 1,
“entity_type”: “candidate”,
“field_name”: “Salutation”,
“field_type”: “dropdown”,
“value”: “”
},
{
“field_id”: 2,
“entity_type”: “candidate”,
“field_name”: “Custom summary”,
“field_type”: “longtext”,
“value”: “”
}

]

Solution in API connector

For the salutation (external field_id = 1) and internal bubble array [0].
custom_fields[0][field_id]
custom_fields[0][value]

For the summary (external field_id = 2) and internal bubble array [1].
custom_fields[1][field_id]
custom_fields[1][value]

And so on for more field to pass …

Used this because of the external system ONLY allows requests with form-data for this request.

Hope this helps.
Every hint, extension or helpful information will be highly appriciated to this topic.

Regards,
Gerald

3 Likes

Your solution is fine if your array is always the same size. If you need something dynamic, it won’t work. There’s a few solutions to help on the forum but the incremental numbering is a big issue actually in Bubble. However,there’s also plugins that will convert a JSON into url form data

2 Likes