Android Device Registration
This section provides the details of the REST APIs that are used with regard to Android device registration.
Registering an Android device
Description | When carrying out device registration via an Android device, you need to initially install an Android Agent on the device, before being able to register the device with WSO2 EMM. Instead, you can use this REST API to register an Android device with WSO2 EMM, without having to install an Android Agent on the respective device. | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
URL | /mdm-android-agent/enrollment | ||||||||||||||||||||||||
HTTP Method | POST | ||||||||||||||||||||||||
Request/Response Format | application/json | ||||||||||||||||||||||||
cURL command | curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -k -d @'<JSON_PAYLOAD>' -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-android-agent/enrollment
Example: Register an Android device where the device identifier is 867115026844132. curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer e5c2ce5670b6f95e1514f4f9e722a722" -k -d @'enroll.json' -v https://localhost:9443/mdm-android-agent/enrollment | ||||||||||||||||||||||||
Sample output | > POST /mdm-android-agent/enrollment HTTP/1.1 > User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8| zlib/1.2.5 > Host: localhost:9443 > Accept: */* > Content-Type: application/json > Authorization: Bearer e5c2ce5670b6f95e1514f4f9e722a722 > Content-Length: 1504 > Expect: 100-continue > < HTTP/1.1 100 Continue < HTTP/1.1 200 OK < Date: Tue, 22 Mar 2016 01:20:00 GMT < Content-Type: application/json < Content-Length: 75 < Server: WSO2 Carbon Server < {"responseCode":"Created","responseMessage":"Device enrollment succeeded."} | ||||||||||||||||||||||||
Sample JSON Definition | { "description":"hwRIO-L01", "deviceIdentifier":"867115026844132", "enrolmentInfo":{ "ownership":"BYOD", "owner":"admin" }, "name":"hwRIO-L01", "properties":[ { "name":"IMEI", "value":"867115026844132" }, { "name":"IMSI", "value":"413027001101134" }, { "name":"DEVICE_MODEL", "value":"HUAWEI RIO-L01" }, { "name":"VENDOR", "value":"HUAWEI" }, { "name":"OS_VERSION", "value":"5.1" }, { "name":"DEVICE_NAME", "value":"hwRIO-L01" }, { "name":"BATTERY_LEVEL", "value":"77" }, { "name":"LATITUDE", "value":"6.9302368" }, { "name":"LONGITUDE", "value":"79.8617277" }, { "name":"INTERNAL_TOTAL_MEMORY", "value":"24.74" }, { "name":"INTERNAL_AVAILABLE_MEMORY", "value":"18.4" }, { "name":"EXTERNAL_TOTAL_MEMORY", "value":"0.0" }, { "name":"EXTERNAL_AVAILABLE_MEMORY", "value":"0.0" }, { "name":"OPERATOR", "value":"Dialog" }, { "name":"DEVICE_INFO", "value":"[{\"name\":\"IMEI\",\"value\":\"867115026844132\"},{\"name\":\"IMSI\",\"value\":\"413027001101134\"},{\"name\":\"DEVICE_MODEL\",\"value\":\"HUAWEI RIO-L01\"},{\"name\":\"VENDOR\",\"value\":\"HUAWEI\"},{\"name\":\"OS_VERSION\",\"value\":\"5.1\"},{\"name\":\"DEVICE_NAME\",\"value\":\"hwRIO-L01\"},{\"name\":\"BATTERY_LEVEL\",\"value\":\"77\"},{\"name\":\"LATITUDE\",\"value\":\"6.9302368\"},{\"name\":\"LONGITUDE\",\"value\":\"79.8617277\"},{\"name\":\"INTERNAL_TOTAL_MEMORY\",\"value\":\"24.74\"},{\"name\":\"INTERNAL_AVAILABLE_MEMORY\",\"value\":\"18.4\"},{\"name\":\"EXTERNAL_TOTAL_MEMORY\",\"value\":\"0.0\"},{\"name\":\"EXTERNAL_AVAILABLE_MEMORY\",\"value\":\"0.0\"},{\"name\":\"OPERATOR\",\"value\":\"Dialog\"}]" } ] }
For more information on enrolling Android devices, see End-user Registering an Android Device. |
Getting the registration status of an Android device
Description | Use this REST API to retrieve the registration status of an Android device. |
---|---|
Resource Path | /{deviceId} |
URL |
|
HTTP Method | GET |
Request/Response Format | application/json |
cURL command | curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -k -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-android-agent/enrollment/{deviceId}
Example: Retrieve the registration status of the Android device (device identifier - 867115026844132). curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 52492cd670773a39251cd8d6185e8516" -k -v https://localhost:9443/mdm-android-agent/enrollment/867115026844132 |
Sample output | > GET /mdm-android-agent/enrollment/867115026844132 HTTP/1.1 > User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8| zlib/1.2.5 > Host: localhost:9443 > Accept: */* > Content-Type: application/json > Authorization: Bearer 52492cd670773a39251cd8d6185e8516 > Content-Length: 1451 > Expect: 100-continue > < HTTP/1.1 100 Continue < HTTP/1.1 200 OK < Date: Wed, 16 Mar 2016 00:35:17 GMT < Content-Type: application/json < Content-Length: 75 < Server: WSO2 Carbon Server < {"responseCode":"Accepted","responseMessage":"The device has already been enrolled"} |
Updating the registration details of an Android device
Description | Use this REST API to update the registration details of an Android device. | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Resource Path | /{deviceId} | ||||||||||||||||||||||||
URL |
| ||||||||||||||||||||||||
HTTP Method | PUT | ||||||||||||||||||||||||
Request/Response Format | application/json | ||||||||||||||||||||||||
cURL command | curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -k -d @'<JSON_PAYLOAD>' -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-android-agent/enrollment/{deviceId}
Example: Update the enrollment details of the Android device where the device identifier is 867115026844138. curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer cce3d4671a67c09852e445c67e47c09a" -k -d @'u.json' -v https://localhost:9443/mdm-android-agent/enrollment/867115026844138 | ||||||||||||||||||||||||
Sample output | > PUT /mdm-android-agent/enrollment/867115026844138 HTTP/1.1 > User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8| zlib/1.2.5 > Host: localhost:9443 > Accept: */* > Content-Type: application/json > Authorization: Bearer cce3d4671a67c09852e445c67e47c09a > Content-Length: 313 > < HTTP/1.1 200 OK < Date: Thu, 24 Mar 2016 09:36:49 GMT < Content-Type: application/json < Content-Length: 90 < Server: WSO2 Carbon Server < * Connection #0 to host localhost left intact {"responseCode":"Accepted","responseMessage":"The device enrollment details has been updated successfully"} | ||||||||||||||||||||||||
Sample JSON | { "description":"hwRIO-L01", "deviceIdentifier":"867115026844132", "enrolmentInfo":{ "ownership":"BYOD", "status":"ACTIVE", "owner":"admin", "dateOfEnrolment":"1445438864650" }, "name":"hwRIO-L01", "properties":[ { "name":"IMEI", "value":"867115026844132" }, { "name":"IMSI", "value":"413027001101134" }, { "name":"DEVICE_MODEL", "value":"HUAWEI RIO-L01" }, { "name":"VENDOR", "value":"HUAWEI" }, { "name":"OS_VERSION", "value":"5.1" }, { "name":"DEVICE_NAME", "value":"hwRIO-L01" }, { "name":"BATTERY_LEVEL", "value":"77" }, { "name":"LATITUDE", "value":"6.9302368" }, { "name":"LONGITUDE", "value":"79.8617277" }, { "name":"INTERNAL_TOTAL_MEMORY", "value":"24.74" }, { "name":"INTERNAL_AVAILABLE_MEMORY", "value":"18.4" }, { "name":"EXTERNAL_TOTAL_MEMORY", "value":"0.0" }, { "name":"EXTERNAL_AVAILABLE_MEMORY", "value":"0.0" }, { "name":"OPERATOR", "value":"Dialog" }, { "name":"DEVICE_INFO", "value":"[{\"name\":\"IMEI\",\"value\":\"867115026844132\"},{\"name\":\"IMSI\",\"value\":\"413027001101134\"},{\"name\":\"DEVICE_MODEL\",\"value\":\"HUAWEI RIO-L01\"},{\"name\":\"VENDOR\",\"value\":\"HUAWEI\"},{\"name\":\"OS_VERSION\",\"value\":\"5.1\"},{\"name\":\"DEVICE_NAME\",\"value\":\"hwRIO-L01\"},{\"name\":\"BATTERY_LEVEL\",\"value\":\"77\"},{\"name\":\"LATITUDE\",\"value\":\"6.9302368\"},{\"name\":\"LONGITUDE\",\"value\":\"79.8617277\"},{\"name\":\"INTERNAL_TOTAL_MEMORY\",\"value\":\"24.74\"},{\"name\":\"INTERNAL_AVAILABLE_MEMORY\",\"value\":\"18.4\"},{\"name\":\"EXTERNAL_TOTAL_MEMORY\",\"value\":\"0.0\"},{\"name\":\"EXTERNAL_AVAILABLE_MEMORY\",\"value\":\"0.0\"},{\"name\":\"OPERATOR\",\"value\":\"Dialog\"}]" } ] }
|
Unregistering an Android device
Description | Use this REST API to unregister a specific Android device. |
---|---|
Resource Path | /{deviceId} |
URL |
|
HTTP Method | DELETE |
Request/Response Format | application/json |
cURL command | curl -X DELETE -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -k -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-android-agent/enrollment/{deviceId}
Example: Unregister the Android device (device identifier - 867115026844132). curl -X DELETE -H "Content-Type: application/json" -H "Authorization: Bearer e5c2ce5670b6f95e1514f4f9e722a722" -k -v https://localhost:9443/mdm-android-agent/enrollment/867115026844132 |
Sample output | {"responseCode":"Accepted","responseMessage":"The device has been removed successfully"} |