So at this point, you learned how to create your REST API key, how to use Workspace One UEM API website and how to check internal applications using REST API, am I right?
Well, that’s ok but I know a lot of people which like to use terminal window instead of tradicional web pages, with all your clicks, uploads, etc…
If you’re a kind of person I described above, this post is for you!
Using Command Line and REST API for Workspace One UEM
First of all, we need to follow the same steps we did in the previously posts: Authenticate, Get Authorised and Request what you would like to. So, let’s digging in:
Note: I will use CURL for all process. If you want to know more about CURL, check this website.
Authentication and Authorization
Let’s use basic authentication (administrator username you have into Console) and the environment you’re connection to. In my case, will be cn258.awmdm.com
curl -v –basic -u td.tvalcesia https://cn258.awmdm.com

Just type your password to get connected.
If everything worked properly, you’ll receive your Authorization: Basic.
Copy that, ok?!

Now it’s time to a more complex command…
Let’s reproduce the same steps we did on this post but using only CURL.
You’ll need for this:
- Authorization: Basic key
- API KEY
- Your Environment: https://asXXX.awmdm.com
The syntax is the following:
curl -X GET –header ‘AcceptL application/json’ –header ‘Authorization: Basic ‘HERE_YOU_NEED_YOUR_AUTHORIZATION‘ –header ‘aw-tenant-code: HERE_YOU_NEED_YOUR_API_KEY‘ ‘https://asXXX.awmdm.com/API/man/apps/search? type=App&applicationtype=Internal’
In my case, this is the final command (IMPORTANT: I’ve changed my Authorization and API Key for security reasons);
curl -X GET --header 'Accept: application/json' --header 'Authorization: Basic dGQudHAKJSHDNlc2lhOkx0enQAJGHYSOhbWEybWlh' --header 'aw-tenant-code: c6DOpiFk/LAKHSDOASDPvdbRlAVh2LJHADS)ptd8=' 'https://as258.awmdm.com/API/mam/apps/search?type=App&applicationtype=Internal'
The follwing information will be available for you:

If you go back to Workspace ONE UEM API Explorer, you can see the CURL command showing up for you as well.

I wish you can explore more your REST API knowledge with this steps I did.
Enjoy the Ride!
Great posts! Would love to see one about how to upload and distribute ipa via API.
LikeLiked by 1 person
Hey! Thanks for your comment Erik! I think you’ve just inspired me to write about that! = o )
LikeLike
That would be great!
LikeLike
One thing to note here is that depending on your API and UEM console version you will need a “locationgroupid”, I had to use/add that to my command string. I used my root OG ID and everything worked great. Now question how would I parse this to a document formatted “pretty”?
LikeLike
I got it you can format the JSON with the following command to terminal window: python -m json.tool
or
to a file when needed: python -m json.tool > ~/Desktop/(file name)
LikeLike
That’s great Xavier! Thanks for sharing!
LikeLike
do you have an idea of how to sync a group of devices in an OG, a large number of them using bash and the REST API?
LikeLike
I figured it out. great post here: https://mobile-jon.com/2019/11/30/a-foray-into-working-with-the-vmware-workspace-one-apis/
LikeLike
Great site and information! Thanks for shared that Xavier!
LikeLike
Hey,
got an issue with the API. I Want to read User Groups with the /usergroups/{Usergroupid}/users command. The group (lets say 14) exists. However I get a message, either the group does not exist or i do not have permission. We use location Groups, so the user group is in the location 570. Is there any way to switch the location? I Already tried to user different api Keys, Used thje Location group ID in the header but nothing worked. I Hope, you have an Idea.
LikeLike
Hi there Jörg,
If I got it right, you need to use this command for your use case:
curl –location –request GET ‘https://asXXX.awmdm.com/API/system/usergroups/{GroupID}/users’ \
–header ‘Accept: application/json’ \
–header ‘aw-tenant-code: {API_TOKEN}’ \
–header ‘Authorization: Basic {AUTHN_KEY}’
In my case, 4055 was my {GroupID}.
Just change to your environment variables properly and you’re ready to make this call. Let me know if this helped.
LikeLike
Hi Thiago,
I finally could find out, what my problem was. It is a flaw in the documentation. They don`t make it clear, that this particular command only works for custom groups. We use AD based groups, so the command responded with the errormessage.
LikeLike