elias1
October 20, 2023, 2:36pm
1
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:
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:
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
elias1
October 20, 2023, 2:58pm
3
Appreciated you anwer.
I have tried your approach and the API call accepted the request:
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.
elias1
October 20, 2023, 3:01pm
5
Ok, I got the type. Thank you very much.
system
Closed
December 29, 2023, 2:36pm
6
This topic was automatically closed after 70 days. New replies are no longer allowed.