AirWatch: How to use the REST API

According to the "AirWatch REST API Guide" PDF document that you can get in, you need:

  • the URL : https://<host>/API/v1/help
  • the Token: aw-tenant-code (or API Key)
  • Authorization: Basic base64.b64encode("username:password")

How to find the Token

  1. Select the right Organization Group
  2. Go to Group & Settings > System > Advanced > API > REST > General
  3. Select "Override"
  4. an API Key will be generated. This is your "aw-tenant-code"

How to Authorize

The easiest way is to use Basic authentication.

  1. Make sure your admin has the correct role. In production, you should create a custom Role, but for test, Console Administrator is fine. Make sure he's in the correct OG, of course.
  2. The form should be "username:password", encoded using Base64. You can do this on OS X terminal (see below)
$ python -c "import base64; print base64.b64encode('login:password')"

How to test with Curl

$ curl -X "GET" "" \ -H "Authorization: Basic bG9naW46cGFzc3dvcmQ=" \ -H "aw-tenant-code: bG9naW46cGFzc3dvcmFzZG/2FmYXNkZmFkc2Zhc2Zk="

With Python

# Install the Python Requests library:
# `pip install requests`

import requests

def send_request():
    # My API
    # GET

        response = requests.get(
                "Authorization": "Basic bG9naW46cGFzc3dvcmQ=",
                "aw-tenant-code": "bG9naW46cGFzc3dvcmFzZGZ/2FmYXNkZmFkc2Zhc2Zk=",
        print('Response HTTP Status Code: {status_code}'.format(
        print('Response HTTP Response Body: {content}'.format(
    except requests.exceptions.RequestException:
        print('HTTP Request failed')

Or just use Paw ;-)

One More Thing…

It doesn't work with OS X clients:

<AirWatchFaultContract xmlns="" xmlns:i="">
  <Message>Functionality not supported for device type : AppleOsX</Message>