How do I send a POST api request with a array?

Hi forum,

I have a question about connecting to a other API.
This is the docs:

This is my. setup:

FYI: I need to send a “lead”, each lead has the above parameters (product_id, name etc), but I also need to send “Product specific questions”, that is a array within the questions parameters.

The question is: how can I send this “Product specific questions” within this post api?

The docs are dutch, verplicht means mandatory

I personnally prefer to use json body instead of parameters, but Bubble will send your “parameters” as JSON if there’s no header (but you should always add the Content-type header). The main issue with the parameters is that Bubble will send everything as string while in JSON, there’s different type of value (boolean, null, number, array, object…)
The best is to move your parameters to body and encode properly as JSON

{
"product_id":"<product_id>",
"name":"<name>",
"questions":[<questions>]
}

Is just an example. In questions value field, you will be able to complete the array dynamically. It’s also possible to develop more in questions array by adding object in it and complete with all the question you need to fill like "questions":["105":<105>,"104":<104>]

1 Like