Help with search in get request for Workspace One MDMv2 API

Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.

Here’s an outline with best practices for making your inquiry.

My question: Help with syntax for search in a Get request to the MDM REST API v2 of Workspace One.

Details (like screenshots): I’m stuck trying to search be device id on a Get request with the Workspace One API.
Per the documentation, I should be able to search in a Get request by id:

The id number of the device I want to test is 4466. When I plug this id to the end of the URL, it works, pulling just the one device with this id number.

What I want to do is convert this to a search string. I’ve tried a number of variations; however, all of them either return an error, or they return over 3500 results (basically returns all the devices instead of the one).
variations:
…awmdm.com/API/mdm/devices/search?id=4466
…awmdm.com/API/mdm/devices/search?id&value=4466
…awmdm.com/API/mdm/devices/search?Deviceid=4466
…awmdm.com/API/mdm/devices/search?Deviceid&value=4466
…awmdm.com/API/mdm/devices/search?Deviceid&id=4466

Would anyone be able to assist on how I can search a device by its Id field (not the Uuid field)?

Thank you,
Kendra

Your output is showing XML instead of JSON.

If its a REST interface then it should be JSON which is easier to parse and target elements.

Not sure how your API works, but try adding output=JSON as a parameter.

Your bigger question on what the API will accept in the search parameters will be down to the API, so you’ll have to refer to the API documentation. Hopefully, they will have included example requests for the most common activities.

You wouldn’t normally combine the two like you are doing.

If searching on multiple parameters, they would usually be separate.

id=4466&deviceid=4446

Your original question asked how to search by ID, which you already know how to do as you can do it by editing the URL.

All you should really need to do is create a parameter called ID in the request params. This should get automatically appended to the URL.

1 Like

Thank you @michaelderekjones! You are 100% correct about the need to create a parameter in the request params, which is appended to the URL. By including that in the custom connector to Workspace One in Power Automate, I was able to search with device id. When I looked again at the documentation using search, it didn’t include device id (only the uuid, which I didn’t have available to me to search with) so going with the parameter was the answer. Below is a snippet of where and how to do this should anyone else be working with this particular API within Power Automate and need to also create the parameter.

Thank you!
@kky1