Get device
Get the information associated to a device running an application.
Devices can be identified by their regular device identifier or by a custom user identifier. The custom user identifier is simply a special reserved tag, which key is userid
. To set this special tag, use the Tag devices command or use the SDK’s sendAppInfo
function.
Request
Get device by device ID or by user ID.
Method | Request URI | HTTP version |
---|---|---|
GET | https://management.azure.com/subscriptions/{subscription-id}/resourcegroups/{resource-group-name}/providers/Microsoft.MobileEngagement/appcollections/{app-collection}/apps/{app-resource-name}/devices/{deviceid}?api-version=2014-12-01 | HTTP/1.1 |
GET | https://management.azure.com/subscriptions/{subscription-id}/resourcegroups/{resource-group-name}/providers/Microsoft.MobileEngagement/appcollections/{app-collection}/apps/{app-resource-name}/users/{userid}?api-version=2014-12-01 | HTTP/1.1 |
Authentication
See Authentication.
Request URI Path Parameters
Parameter | Description |
---|---|
deviceid | Device identifier (use only with the /devices/{deviceId} URI). |
userid | User identifier (use only with the /users/{userId} URI).It’s a special tag, see Response Body below. |
Query String Parameters
Parameter | Description |
---|---|
api-version | API version, the only supported value is 2014-12-01 . |
Request Headers
The following table describes required and optional request headers.
Request Header | Description |
---|---|
Authorization | See Authentication. |
Accept (optional) | Its recommended to pass */* or application/json to have JSON error responses. |
Request Body
None.
Response
Response Status Codes
Code | Description |
---|---|
200 | Device information is returned as JSON. |
400 | Invalid parameters or application is disabled. Check response body for details. |
401 | Authentication error. |
404 | Device/User not found. |
For information about status codes, see Status and Error Codes.
Response Headers
Location | URI of the new resource. The last segment of the URI is the campaign identifier. |
Response Body
A JSON object containing the following properties if the request was successful.
Property | Description |
---|---|
deviceId | Device identifier. |
meta | Application usage data in the form of a JSON object with the following properties. firstSeen : First time the device used the application in milliseconds since January 1st, 1970 UTC. lastSeen : Last time the device used the application in milliseconds since January 1st, 1970 UTC. lastInfo : Timestamp corresponding to the info object in milliseconds since January 1st, 1970 UTC. lastLocation : Timestamp corresponding to the location object in milliseconds since January 1st, 1970 UTC. nativePushEnabled : Boolean indicating if native push notifications (like Android’s GCM or Apple’s APNS) are enabled for the application. This boolean is set to true when the application registers successfully to the native push service, and set to false when the native push service reports to Mobile Engagement that the application can no longer be pushed (which means that it has been uninstalled). This report is performed a few hours after Mobile Engagement has tried to perform a native push to a device on which the application has been uninstalled. |
info | JSON object containing the last technical data received (concerning device, system, network and application identification). phoneModel : Phone model. phoneManufacturer : Phone manufacturer. firmwareVersion : Firmware version. firmwareName : Firmware name. androidAPILevel : Android API level. carrierCountry : Carrier country. carrierName : Carrier name. locale : Locale code. networkType : Network type. networkSubType : Network sub-type. applicationVersionName : Application version name. applicationVersionCode : Application version code. timeZoneOffset : The offset in minutes from UTC for the device time zone, including daylight savings time. serviceVersion : SDK version. |
location | Last geo-location data received as a JSON object with the following properties. countrycode : The ISO 3166 two-letter country code. region : An administrative region of the nation, such as a state or province. locality : A locality within the administrative region, such as a town or city. |
appInfo | Also known as tags, a key-value set as a JSON object with the following properties. Some tags are standard tags defined by Azure Mobile Engagement and others are defined by the application. userid : Standard tag. Customer specific user identifier (e.g. alice ), this value can be used to reference the device when using this API or the Tag devices API.optin : Standard tag. User global opt-in to Mobile Engagement Reach service ( true or false ).apsEnabledNotifications : Standard tag. For iOS applications only. An integer bit mask indicating the types of notifications enabled in the application (i.e. badges, sounds, alerts and Newsstand assets). This value is the same as the return value from UIApplication#enabledRemoteNotificationTypes (15: all types of notifications are enabled, 0: none are enabled).badge : Standard tag. For iOS applications only. An integer indicating the current badge value of the application. This value is used and updated by Native push campaigns in the Reach API. <custom boolean tag name> : Custom tag. Custom boolean tag (one of true or false ).<custom integer tag name> : Custom tag. Custom integer tag (e.g. -1200546666 ).<custom date tag name> : Custom tag. Custom date tag (CCYY-MM-DD format: e.g. 1969-12-07 stands for 7 Dec 1969).<custom string tag name> : Custom tag. Custom string tag (e.g. My string ). |
The following is an example entity.
{
"deviceId": "1234567890abcdef1234567890abcdef",
"appInfo": {
"userid": "alice",
"optin": "true",
"mycustomboolean", "true",
"mycustomstring", "My string"
},
"info": {
"androidAPILevel": 10,
"applicationVersionCode": 11226,
"applicationVersionName": "3.0.0",
"carrierCountry": "fr",
"carrierName": "F SFR",
"firmwareName": "GRJ22",
"firmwareVersion": "2.3.4",
"locale": "fr",
"networkSubtype": "UMTS",
"networkType": "mobile",
"phoneBrand": "google",
"phoneManufacturer": "samsung",
"phoneModel": "Nexus S",
"serviceVersion": "3.0.0",
"timeZoneOffset": 120
},
"location": {
"countrycode": "FR",
"locality": "Rennes",
"region": "Brittany"
},
"meta": {
"firstSeen": 1303288678955,
"lastInfo": 1304499010021,
"lastLocation": 1304497692151,
"lastSeen": 1304499010021,
"nativePushEnabled": false
}
}
Example
Example using device identifier.
GET /subscriptions/84211edf-7c40-4c47-b152-a6a7233843b7/resourcegroups/MobileEngagement/providers/Microsoft.MobileEngagement/appcollections/myAppCollection/apps/myApp-android/devices/9ea8bb714d1b44cab68d1db47d0ca791?api-version=2014-12-01 HTTP/1.1
Host: management.azure.com
Accept: */*
Content-Type: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSIsImtpZCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuY29yZS53aW5kb3dzLm5ldC8iL
HTTP/1.1 200 OK
Content-Type: application/json
{
"deviceId": "9ea8bb714d1b44cab68d1db47d0ca791",
"appInfo": {
"userid": "alice",
"optin": "true"
},
"info": {
"serviceVersion": "4.1.1",
"phoneManufacturer": "Asus",
"phoneModel": "Nexus 7",
"screenSize": "1200x1824",
"androidAPILevel": "23",
"firmwareName": "MRA58V",
"applicationVersionName": "4.1.1",
"timeZoneOffset": "-480",
"applicationVersionCode": "401010",
"firmwareVersion": "6.0",
"networkType": "Wifi",
"locale": "EN"
},
"location": {
"countrycode": "US",
"locality": "Redmond",
"region": "Washington"
},
"meta": {
"lastSeen": 1447450732663,
"firstSeen": 1447284423992,
"lastLocation": 1447373324254,
"lastInfo": 1447450733711,
"nativePushEnabled": true
}
}
Example using user identifier.
GET /subscriptions/84211edf-7c40-4c47-b152-a6a7233843b7/resourcegroups/MobileEngagement/providers/Microsoft.MobileEngagement/appcollections/myAppCollection/apps/myApp-android/users/myUserId?api-version=2014-12-01 HTTP/1.1
Host: management.azure.com
Accept: */*
Content-Type: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSIsImtpZCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuY29yZS53aW5kb3dzLm5ldC8iL
HTTP/1.1 200 OK
Content-Type: application/json
{
"deviceId": "9ea8bb714d1b44cab68d1db47d0ca791",
"appInfo": {
"userid": "alice",
"optin": "true"
},
"info": {
"serviceVersion": "4.1.1",
"phoneManufacturer": "Asus",
"phoneModel": "Nexus 7",
"screenSize": "1200x1824",
"androidAPILevel": "23",
"firmwareName": "MRA58V",
"applicationVersionName": "4.1.1",
"timeZoneOffset": "-480",
"applicationVersionCode": "401010",
"firmwareVersion": "6.0",
"networkType": "Wifi",
"locale": "EN"
},
"location": {
"countrycode": "US",
"locality": "Redmond",
"region": "Washington"
},
"meta": {
"lastSeen": 1447450732663,
"firstSeen": 1447284423992,
"lastLocation": 1447373324254,
"lastInfo": 1447450733711,
"nativePushEnabled": true
}
}