Convert comma-separated string to an array of strings for API transfer

By: Danielle Potter | Asked: 08/08/2024
ForumsCategory: Code HelpConvert comma-separated string to an array of strings for API transfer
Danielle Potter asked 4 months ago

Hello! I am setting up an API connection from Formidable Forms to Brevo. I can get the name and email to transfer over but I have a custom multiple-select question whose data I also need to transfer. Formidable by default, passes multi-select values in a comma-separated format. Brevo, however, expects multiple-choice attributes to be sent as an array of strings. Here is what I have so far:  {
"updateEnabled": true,
"email": "[376]",
"emailBlacklisted": false,
"smsBlacklisted": false,

"attributes": {
"FIRSTNAME": "[374]",
"LASTNAME": "[375]",
"GENRE": ["[385]"]

},
"listIds": [2]
} This code only transfers genre data if only the first checkbox in the list is selected. If anything else is selected, on its own or in addition to the first option, no genre data transfer. Any ideas on how to get it to send as an array? Thanks!

Question Tags:
1 Answers
Victor Font answered 4 months ago
You're not structuring genre as an array. Not being familiar with what Brevo expects, I have no idea how to help you structure this. Have you ever used Postman? Before I ever create an API in Formidable to an external system, I use Postman to structure and test the XML. Once it works in Postman, it's pretty simple to copy the payload and convert it to Formidable.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right