Directory API: Mobile Devices

Retrieve all mobile devices

To retrieve all of an account's mobile devices, use the following GET request and include the authorization described in Authorize requests. For readability, this example uses line returns:

GET https://www.googleapis.com/admin/directory/v1/customer/my_customer or customerId
/devices/mobile?projection=basic or full&query=query
&orderBy=orderBy category&sortOrder=ascending or descending order
&pageToken=token for next results page
&maxResults=max number of results per page

  • The customerId is a unique identifier of the customer's Google account.
  • Another way to get the customerId is in the response of the Retrieve a user method. For this approach, the method's userKey uses the email address or unique user id of the user who owns the device.
  • This document assumes you have successfully completed the Prerequisites. Android devices need to have the device policy app installed; iOS devices must be registered with the Google Mobile Management service.
For the request and response properties, see the API Reference.

JSON response

{
   "kind": "directory#mobiledevices",
   "mobiledevices": [
    {
     "kind": "directory#mobiledevice",
     "resourceId": "resourceId value",
     "deviceId": "deviceId value",
     "name": [
      "Sales"
     ],
     "email": [
      "sales@example.com"
     ],
     "model": "Nexus 4",
     "os": "Android 4.2.2",
     "type": "ANDROID",
     "status": "APPROVED",
     "hardwareId": "1234567890",
     "firstSync": "2013-05-15T17:30:04.325Z",
     "lastSync": "2013-06-05T17:30:04.325Z",
     "userAgent": "Google Apps Device Policy 4.14",
   },
   {
     "kind": "directory#mobiledevice",
     "resourceId": "resourceId value",
     "deviceId": "deviceId value",
     "name": [
      "Liz"
     ],
     "email": [
      "liz@example.com"
     ],
     "model": "Galaxy Nexus",
     "os": "Android 4.2.2",
     "type": "ANDROID",
     "status": "APPROVED",
     "hardwareId": "9123456780",
     "firstSync": "2013-06-05T17:30:04.325Z",
     "lastSync": "2013-08-12T17:30:04.325Z",
     "userAgent": "Google Apps Device Policy 4.14",
    }
   ],
   "nextPageToken": "nextPageToken value"
  }

Retrieve a mobile device

To retrieve a mobile device's properties, use the following GET request and include the authorization described in Authorize requests. For readability, this example uses line returns:

GET https://www.googleapis.com/admin/directory/v1/customer/my_customer or customerId
/devices/mobile/resourceId?projection=full or basic

  • The customerId is a unique identifier of the customer's Google account.
  • Another way to get the customerId is in the response of the Retrieve a user method. For this approach, the method's userKey uses the email address or unique user id of the user who owns the device.
  • The resourceId is a unique Google identifier for a device and is found in the response of the Retrieve all mobile devices method.
  • This document assumes you have successfully completed the Prerequisites. Android devices need to have the device policy app installed; iOS devices must be registered with the Google Mobile Management service.
For the request and response properties, see the API Reference.

JSON request

An example request for the resouceId is:

GET https://www.googleapis.com/admin/directory/v1/customer/my_customer/devices/
mobile/resourceId value?projection=full

JSON response

{
   "kind": "directory#mobiledevice",
   "resourceId": "resourceId value",
   "deviceId": "deviceId value",
   "name": [
    "Sales3"
   ],
   "email": [
    "sales@example.com"
   ],
   "model": "Nexus 4",
   "os": "Android 4.2.2",
   "type": "ANDROID",
   "status": "APPROVED",
   "hardwareId": "1234567890",
   "firstSync": "2010-05-15T17:30:04.325Z",
   "lastSync": "2013-06-05T17:30:04.325Z",
   "userAgent": "Google Apps Device Policy 4.14",
  }

Take action on a mobile device

To take an action that impacts a mobile device, use the following POST request and include the authorization described in Authorize requests. For readability, this example uses line returns:

POST https://www.googleapis.com/admin/directory/v1/customer/my_customer or customerId
/devices/mobile/resourceId/action

  • The customerId is a unique identifier of the customer's Google account.
  • Another way to get the customerId is in the response of the Retrieve a user method. For this approach, the method's userKey uses the email address or unique user id of the user who owns the device.
  • The resourceId is a unique Google identifier for a device and is found in the response of the Retrieve all mobile devices method.
  • This document assumes you have successfully completed the Prerequisites. Android devices need to have the device policy app installed; iOS devices must be registered with the Google Mobile Management service.
For the request and response properties, see the API Reference.

JSON request

The following JSON request shows a sample request to approve a device:

POST https://www.googleapis.com/admin/directory/v1/customer/my_customer/devices
/mobile/resourceId value/action

The request body is:

{
    "action": "approve"
}

A successful response returns an HTTP 200 status code.

Remove a mobile device

To remove a mobile device, use the following DELETE request and include the authorization described in Authorize requests. For readability, this example uses line returns:

DELETE https://www.googleapis.com/admin/directory/v1/customer/my_customer or customerId
/devices/mobile/resourceId

  • The customerId is a unique identifier of the customer's Google account.
  • Another way to get the customerId is in the response of the Retrieve a user method. For this approach, the method's userKey uses the email address or unique user id of the user who owns the device.
  • The resourceId is a unique Google identifier for a device and is found in the response of the Retrieve all mobile devices method.
  • This document assumes you have successfully completed the Prerequisites. Android devices need to have the device policy app installed; iOS devices must be registered with the Google Mobile Management service.
For the request and response properties, see the API Reference.

A successful response returns an HTTP 200 status code.

Send feedback about...

Directory API
Directory API