How to Use Workspace One UEM API? – Part III

12 comments

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:

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!

12 comments on “How to Use Workspace One UEM API? – Part III”

  1. 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”?

    Like

  2. 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)

    Like

  3. 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?

    Like

  4. 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.

    Like

    1. 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.

      Like

      1. 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.

        Like

Leave a Reply to Thiago Valcesia Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.