How to send a list of objects using bubble's API connector?

Hello everyone.

I have to make a POST request for an API endpoint with the following payload:

{
   "voucher_number":<voucher_number>,
   "contact":{
      "name":<name>,
      "phone":<phone>,
      "email":<email>
   },
   "customers":[
      {
         "customer_type_rate":<customer_type_rate>
      }
   ],
   "note":<note>
}

However, I need to send (in many cases) more than one “customer_type_rate” within the “customer” list.

Here is the call:

image

My doubt are:

  • How will I send objects to the customer lists with “{…}” curly braces?
  • If I use the customers as field how will I initialize the API since the API is expecting a list of “customer_type_rating”?

You can edit the API connector to show customers as:

"customers": [<customers>]

Then when you dynamically add customers you can use the following method to dynamiclaly pass in each customer type rate:
Screenshot 2023-10-20 at 9.50.30 AM

When initializing you can just pass in one or two but the fact that it is inside the array brackets it will know it is a list.

2 Likes

Appreciated you anwer.

I have tried your approach and the API call accepted the request:

image

Basically I just added the object within the parameter value.

I will mark it as the answer. Appreciated.

I see the type rate is a number so just note that when you follow my example of how to dynamically add the customers as text, you should not add quotes around the type rate as I did in my example.

Ok, I got the type. Thank you very much.

This topic was automatically closed after 70 days. New replies are no longer allowed.