Getting "The request body was not well-formed." Error


#1

I am trying to create multiple groups using curl. i amusing json input file to read the group names.

  curl -k -v -X POST -H "Accept: application/json" -H "Content-Type: **strong text**application/json" -H "Authorization: SSWS xxxxxxxx" -d "@group.json"
  "https://mytesturl.com/api/v1/groups"

my group.json file is as below but i’ m getting “errorSummary”:“The request body was not well-formed.”

{
  "profile":  [{
      "name": "testgroup1",
      "description": "testgroup1"
    },
    {
      "name": "testgroup2",
      "description": "testgroup2"
    },
    {
      "name": "testgroup3",
      "description": "testgroup3"
    },
    {
      "name": "testgroup4",
      "description": "testgroup4"
    }]
}

The same command works fine if i just have one key value

{
  "profile": {
    "name": "testgroup1",
    "description": "testgroup1"
  }
}

What should i do to have curl to process multiple entries in my json file to create multiple groups? Many Thanks!


#2

We do not support creating multiple groups with a single request. You need to issue a request for each group.