AddNestedGroup API call gives ""value" must be array"

addNesteGroup requires me to add “group_id_to_add” parameter into body of the request I am sending.

My preset for the fetchRequest js looks like this:

const url = `https://${extension}/api/groups/`{group_id}/nested`
const options = {
    method: 'PATCH',
    headers: {
        'Content-Type': 'application/json',
         Authorization: `Bearer ${token}`
   body: JSON.stringify({ "group_id_to_add": [ group_id_1, group_id_2 ]  })

What I receive is message saying: ““value” must be an array”.

What am I missing?

Thank you!

1 Like

Hi @PetrStoklas

You are passing an object in the body:

  "group_id_to_add": [ 

whereas the schema (linked from this code) expects just an array, like this:


Does that help?

Yes that helped.

This makes totally sense. I just thought I have to mention the name of the parameter somewhere.

Thank you very much.

Glad you were able to figure it out @PetrStoklas with @nicolas_sabena knowledge! Team win!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.