An interesting use case I had recently was to export all devices and their information, through API, from the Workspace One UEM console.
The reason for this was to import device data into ServiceNOW to be used within support tickets as well as asset information.
The first step is to find the API that we will need and setup the authentication.
Workspace One has an extensive list of APIs that can be leveraged. To find APIs and receive help, navigate to your https://WorkspaceOneUEMconsole.awmdm.com/api/help URL. ours is: https://cn.eucse.com/api/help/#!/apis
There’s a lot of useful information on getting started with your Workspace One UEM APIs. Read through the ‘Getting Started’ section for some useful tips and tricks.
To identify the APIs you require, navigate to the ‘APIs’ tab.
To export all device information from your console you’ll need: MDM (Mobile Device Management) REST API V2
The overview will tell you what this specific API is for:
“AirWatch REST APIs allows you to manage all the functionalities of Mobile Device Management (MDM). The functionalities that are included but not limited to are device commands, retrieval of compliance, profile, network, location, and event log details. As an administrator, you need to enable Devices admin role permissions in Accounts > Administrators > Roles page to access MDM functionalities through APIs.”
Navigate to ‘API Reference’ – This page will allow you to test API’s to make sure you’re ‘GET’ting or ‘POST’ing the correct information.
In order to begin, we’ll have to authenticate against our environment. Leave this page open and open another tab to your Workspace One UEM console. We’re now going to create a new Admin account and aw-tenant-code (REST API).
- Navigate to: Accounts->Administrators
- Click ‘List View’
- Add Admin
- Under roles, make sure your new admin has the role of Console administrator or AirWatch Administrator
Now that our admin is created, we need to add a new REST API entry, this will be referenced as aw-tenant-code when leveraging APIs.
Now navigate to: Groups&Settings->All Settings->System->Advanced->API->REST API
Click Add and create a new API with admin as the account type. Make a note of the API Key, we’ll need that for the aw-tenant-code.
Head back to the API reference tab.
Make sure the host and base URL are set correctly. For my environment, I have the following:
We now need to Authorise against the console.
Click on the Authorise button.
Scroll down to ‘Basic Authentication’
Add the Admin Username and password into the ‘Basic Authentication’ section and hit authorise.
Click back on Authorise again and add the the API key into the aw-tenant-code
Now that you’re authorised, you can scroll down and click ‘Try it out’.
This should then pull all the device information and display it in the response:
Success! You’ve leveraged an API to export the device information!
You can also use something like Postman to export the information, using the same information:
Sales Engineer specialising in Unified Endpoint Management (UEM) and Identity Management.
Technical Expertise:
o Okta – Identity Management – Providing single sign on services to applications
o VMware Workspace ONE – Configuring and managing AirWatch components across all device types.
o Digital Transformation – Helping organisations implement and deploy a modern strategy for UEM
o Networking – VPN, DNS, DHCP
o Device Management – macOS, iOS, Android, Windows and Rugged Devices
o Cloud Solutions – Azure, Office 365, Identity Providers, VMware AirWatch
o Server – Windows Server, Active Directory, Exchange
Gary
October 30, 2019Thanks for this post. I have a question on the syntax of the API for POST /devices/commands/{commandName}/device{searchBy}/{id}.
How does one find the syntax for commandsModel? I haven’t been able to find documentation that details the option values for the available commands.
I’m attempting to use the API to perform a SoftReset or RebootDevice.
Charlie Hodge
October 31, 2019Hi Gary,
Not sure on the exact syntax but I think this is the API you need to reference to perform a soft reset: https://cn763.awmdm.com/api/help/#!/apis/10002?!/CommandsV1/CommandsV1_Execute
If you manage to get it working, we’d love to host a blog post around it!
Thanks,
Charlie.
Gary
October 31, 2019Yes, I’ve tried that one as well.
It’s an oddity to me as there is a parameter customCommandModel it is expecting, but there’s no documentation on what actually goes in there if you are using an existing command like SoftReset.
It does appear that you can create custom commands for certain types of devices, but the SoftReset already exists.
Attempting to default it to the example gives a response code 422 and response body:
{
“errorCode”: 1012,
“message”: “Element: customCommandModel Message: Malformed XML.\r\n”,
“activityId”: “7bee2dde-6a16-41b7-a79f-e9b57d728204”
}
I’ve been waiting a few days on the support ticket I created so hopefully there’s an answer!
Michel Fritzsche
January 15, 2020I also did not find any useful documentation, but i just tryed:
{“CommandXml”: “EnterpriseWipe”}
…and it worked! Simply was guessing put the value into an xml notation 😉
Gary
November 8, 2019I’ve been informed by my AirWatch reseller technical support that it is not possible to reboot the device via API. There is a feature request to do this for Android Managed devices (not BYOD).
avhi
March 3, 2020I tried doing what you did in Postman . Status code is 200 and i see an XML response . But i cant see the equivalent JSON version of the same . When i select JSON in Postman , i see the messege “unexpected <" . What might be wrong?
Cole
July 8, 2020Looks like a few photos have api key values in them. Unless these keys are not tied to anything you might want to edit those photos
Evelyn Vose
October 23, 2020Does anyone know what search term is needed to get device details for device friendly name?
Foo Bar
June 12, 2022Unfortunately, for the longest time the AirWatch REST API has only provided the option to get device details (using Search Device Details method) for 4 different input parameters, Serial Number, IMEI, UDID and Mac Address. If you wanted to get the device details by friendly name you’d have to do a generic search for all devices or a filtered set based off of platform, then compare the list of returned device friendly names one by one with the one you are looking for and save the results somewhere like an output file such as a .csv.