Using Postman client for API use

Solved Locked
Z
Zach
Whole Foods Market, Inc.

Hi all, I’m having some issues with the SOTI API that I’m hoping the community can help out with because the documentation is not being very helpful.

The goal we’re trying to accomplish is using the API to move a set of 6 devices from each of our facility locations to a different folder. Per the documentation the API method we should be using is POST /devicegroups/{path}/members. I've tried a few different ways but it almost always returns 403 Forbidden error with "Message": "Unauthorized access or invalid reference to specified object" or a 404 Not Found.

I am able to run some basic commands like getting folder details or device details:

GET <instanceID>.mobicontrolcloud.com/MobiControl/api/devicegroups/referenceIds:reference_id

GET <instanceID>.mobicontrolcloud.com/MobiControl/api/devices/device_id

From that, I assume I should be doing the following to move the device to the reference_id below but it's not working for me.

POST <instanceID>.mobicontrolcloud.com/MobiControl/api/devicegroups/referenceIds:reference_id/<device_id(s)>

I’ve also tried it with and without the /members/ in between the new path and device IDs as well as the following in the body as JSON:

POST <instanceID>.mobicontrolcloud.com/MobiControl/api/devicegroups/referenceIds:reference_id/<device_id(s)>

{

"path": "referenceIds:reference_id",

"deviceIds": ["device_id"]

}

I get the following error when using the body method:

{   "$type": "ErrorDetails",   "ErrorCode": 0,   "Message": "Contract validation failed",   "Data": [     "deviceGroup.Name: Name is a required field."   ],   "HelpLink": null }

Can anyone tell me what I’m doing wrong? Am I misunderstanding the documentation?

Edited 4 years ago
SOTI MobiControl
ANSWERS
J
JCMOD@SOTI
5 years ago

Hi Zach,

Thank you for posting in SOTI Central,

Can you double check that the {PATH} / path parameter is "referenceId" and not "referenceIds"? You can do this via https://[MobiControl FQDN]:443/MobiControl/api. For your query in general you want to use:

https://[FQDN]:443/MobiControl/api/devicegroups/{path}/members

You replace {path} with "referenceId:c84d6c5e-58bd-4ba6-8316-7e92eeaa3bf6" for example and then setup params for "path" & "deviceIds". Which are reflected for example like: referenceId:c84d6c5e-58bd-4ba6-8316-7e92eeaa3bf6 and [345678987654321, 34567898765433, 34567898765434, 34567898765435].

The request URL without the params will appear as: https://[FQDN]:443/MobiControl/api/devicegroups/referenceId%3Ac84d6c5e-58bd-4ba6-8316-7e92eeaa3bf6/members.

Let us know how it goes.

Regards,

Solution
Z
Zach
5 years ago

Thanks. I typoed in my question but that what is what I was using. However, I was able to get it working through some trial and error.