Create multiple groups through API

Solved
D
Daniel
Test Company

Hello,

I am trying to create groups on Mobicontrol through API and I did create a json file for multiple groups.

It is working when I post to MobiControl/api/devicegroups/ and body contains

{
   "Name": "group A",
   "Path": "\\\\Root\\Groups\\Group A",
   "Icon": "Green",
   "Kind": "Regular"
 }

but it is not working when I post to MobiControl/api/devicegroups/ and body contains

[{
   "Name": "group A",
   "Path": "\\\\Root\\Groups\\Group A",
   "Icon": "Green",
   "Kind": "Regular"
 },

{
   "Name": "group B",
   "Path": "\\\\Root\\Groups\\Group B",
   "Icon": "Green",
   "Kind": "Regular"
 }]

I am getting back the following error message.

{
    "$type": "ErrorDetails",
    "ErrorCode": 0,
    "Message": "Contract validation failed",
    "Data": [
        "deviceGroup: Error parsing value"
    ],
    "HelpLink": null
}

 Is there any way to create multiple groups at once through the API? I am just wonder if the body has to be different when trying to create more than 1 group at once.

Thank you.

Edited 7 years ago
SOTI MobiControl
ANSWERS

Hi Daniel, 

This has been consistent with what we found in support when performing multiple API calls.  For what you are trying to do, as a best practice, we would suggest sending the request as a separate API call and loop the request, to complete a 2nd Group and so on.   Also depending on how many different requests you have we would suggest staggering them to lessen the load in the queue.

Hope this helps,

Solution
D
Daniel
7 years ago

Thank you