I’m sending a list of numbers to on initialization to an API workflow, choosing ‘number’ from the drop down. However it is not recognizing them as a list.
When I try and send a list of numbers I’m getting the error “Should be a list of numbers, but right now it is a number”.
Is there a way to specify it’s and Array / list of number sin the initialzation?
That’s not a list of numbers, it’s a single string (text), which you’re saving as a number (so Bubble thinks it’s a number, even though it’s not).
1 Like
As @adamhholmes says, that one is a string, not a list of numbers. When in doubt, try to exactly match the characters you see on succesful API calls.
Set your shopify_variant_id as a text, and in your request put a static ‘[’ then your list of dynamic numbers (bubble will automatically put a ‘,’ between them, and then a static ‘]’.
1 Like
Hey @andrewmccalister, it’s simply an error with the formatting of your JSON. Putting the number array in quotes makes Bubble interpret it as a string.
{
“numbers”: “[12241,14225151]”
}
Should be
{
“numbers”: [12241,14225151]
}
Then, when you initialize, Bubble will recognise as a list.
Good luck!
1 Like
Thanks all.
Completely missed the “” on the array. fixed now.
1 Like
Turns out I can initiate the Workflow by manually deleting the “” around the […]. But when I run the workflow normally it adds it back as “[…]”.
Can you describe what you mean by 'in your request put a static ‘[’ then your list of dynamic numbers (bubble will automatically put a ‘,’ between them, and then a static ‘]’?
My optimal solution would be to keep the array content as a list of numbers, rather than making text, i.e “[374891, 483201, 7348301]” → [374891, 483201, 7348301].