Hi there,
the person who knows most about functions is out today, but here is an idea:
did you see this functions playground already? there might be an example of what you are trying to do in here.
We can’t, as a general rule, help you learn, write, or debug code (there are sadly only 8 support engineers for hundreds of thousands of sites worldwide) BUT there are many knowledgeable people here in these forums who might have answers for you if you can narrow it down a bit.
The question you’re asking is one more of learning the basics of JavaScript and how to fetch than one specifically oriented at how to use Netlify or its tools. That’s why @perry has to say
We can’t, as a general rule, help you learn, write, or debug code (there are sadly only 8 support engineers for hundreds of thousands of sites worldwide)
So as a general point of direction, I would recommend picking up a course online (there are tons of free ones available!) for learning JavaScript! It’s a fun journey. In the meantime, here’s a quick answer. Please don’t take this and expect to run - I fully recommend doing a proper foundational course on the language.
fetch takes a second argument of options for request data, which should contain a body for the actual body of the request, which ought to be stringified JSON. An array is a valid json value provided it has a valid key.
An array is a valid json value provided it has a valid key.
Here is an example to use “post” and an array with ntl functions:invoke - I use an alias nf: nf utils --port 80 --payload '{"t":[{ "category": "2"},{"category":1 }]}'