This documentation is for WSO2 Enterprise Mobility Manager 2.1.0. View documentation for the latest release.
Operations Management via the Console - Enterprise Mobility Manager 2.1.0 - WSO2 Documentation
||
Skip to end of metadata
Go to start of metadata

This section provides the details of the REST APIs used as operations via the EMM console:

Getting device operation details

DescriptionGet the details of operations carried out on a selected device.
Resource Path/{type}/{id}
URL/mdm-admin/operations/{type}/{id}
HTTP MethodGET
Request/Response Formatapplication/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-admin/operation/{type}/{id}
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.
  • Define the device type as the value for {type}. Example: ios, android or windows.
  • Define the device ID as the value for {id}. For more information, see Retrieving a Device ID.

Example:

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -k -v https://localhost:9443/mdm-admin/operations/ios/f409r4c55924rt4af9a44tts15y9d6cd56h1047d
 Sample output
> GET /mdm-admin/operations/ios/f409r4c55924rt4af9a44tts15y9d6cd56h1047d HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer 686f9b27a6f2d23df5ba94322b9847e1
< HTTP/1.1 200 OK
< Cache-Control: private
< Expires: Thu, 01 Jan 1970 05:30:00 IST
< Date: Thu, 18 Feb 2016 10:57:07 GMT
< Content-Type: application/json
< Content-Length: 1526
< Server: WSO2 Carbon Server
[{"code":"DEVICE_INFO","type":"COMMAND","id":25,"status":"PENDING","receivedTimeStamp":"","createdTimeStamp":"2016-02-18 15:31:05.455","isEnabled":false,"activityId":"ACTIVITY_25"},{"code":"APPLICATION_LIST","type":"COMMAND","id":24,"status":"PENDING","receivedTimeStamp":"","createdTimeStamp":"2016-02-18 15:31:02.951","isEnabled":false,"activityId":"ACTIVITY_24"},{"code":"ALARM","type":"COMMAND","id":23,"status":"PENDING","receivedTimeStamp":"","createdTimeStamp":"2016-02-18 14:57:42.784","isEnabled":false,"activityId":"ACTIVITY_23"}]
Sample JSON Output
Definition 
{  
      "code":"ALARM",
      "type":"COMMAND",
      "id":22,
      "status":"COMPLETED",
      "receivedTimeStamp":"2016-02-18 14:57:09.976",
      "createdTimeStamp":"2016-02-18 14:57:08.976",
      "isEnabled":false,
	  "activityId":"ACTIVITY_22"
   } 

Property Value

Description

code

The code of the operation that you carried out. For example the code of the operation carried out to ring the alarm is ALARM.

type

The operation type that was carried out on the device. The operations types can be one of the following:

  • COMMAND
  • PROFILE
idThe operations carried out on a device is recorded in a database table. The ID of the operation in the database table is given as the ID in the output.
status

The status of the operation that has been carried out on a device. The operation status can be any one of the following:

  • IN-PROGRESS - The operation is processing on the EMM server side and has not yet been delivered to the device.
  • PENDING - The operation is delivered to the device but the response from the device is pending.
  • COMPLETED - The operation is delivered to the device and the server has received a response back from the device.
  • ERROR - An error has occurred while carrying out the operation.
receivedTimeStampThe time WSO2 EMM received the response from the device.
createdTimeStampThe time when the operation was requested to be carried out.
isEnabledIf the assigned value is true it indicates that a policy is enforced on the device. If the assigned value is false it indicates that a policy is not enforced on a device.

activityId

The unique ID used to identify an operation.

Getting operation details by the activity ID

DescriptionEach operation is associated with a unique value or ID known as the activity ID. Using this, you are able to get the details of a preferred operation.
Resource Path/{id}
URL/mdm-admin/operations/activity/{id}
HTTP MethodGET
Request/Response Formatapplication/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-admin/operations/activity/{id}
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.
  • Provide the unique ID associated with the operation as the value for {id}. You can get the activity ID associated with the operation you wish to get details about by running the get device operation details REST API.

Example: Retrieve the operation details that correspond to ACTIVITY_1.

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 9a0dc4b7c4729e7200e0eec0b8ec7168" -k -v https://localhost:9443/mdm-admin/operations/activity/ACTIVITY_1
 Sample output
> GET /mdm-admin/operations/activity/ACTIVITY_1 HTTP/1.1
> User-Agent: curl/7.30.0
> Host: localhost:9443
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer 9a0dc4b7c4729e7200e0eec0b8ec7168
> 
< HTTP/1.1 200 OK
< Cache-Control: private
< Expires: Thu, 01 Jan 1970 05:30:00 IST
< Date: Fri, 29 Apr 2016 13:48:02 GMT
< Content-Type: application/json
< Content-Length: 158
< Server: WSO2 Carbon Server
{"code":"NOTIFICATION","type":"PROFILE","id":7,"status":"COMPLETED","createdTimeStamp":"2016-05-12 23:28:34.13","isEnabled":true,"payLoad":"{\"message\":\"Hi John, Please come to meeting room\"}","activityId":"ACTIVITY_7","responses":[{"response":{"timestamp":"Thu May 12 23:27:52 GMT+05:30 2016","status":"RECEIVED","deviceState":"unlocked"},"recievedTimeStamp":"2016-05-12 23:29:03.663"},{"response":{"timestamp":"Thu May 12 23:29:08 GMT+05:30 2016","status":"DISMISSED"},"recievedTimeStamp":"2016-05-12 23:30:32.161"}]}
Sample JSON Output Definition 
{  
   "code":"NOTIFICATION",
   "type":"PROFILE",
   "id":7,
   "status":"COMPLETED",
   "createdTimeStamp":"2016-05-12 23:28:34.13",
   "isEnabled":true,
   "payLoad":"{\"message\":\"Hi John, Please come to the meeting room\"}",
   "activityId":"ACTIVITY_7",
   "responses":[  
      {  
         "response":{  
            "timestamp":"Thu May 12 23:27:52 GMT+05:30 2016",
            "status":"RECEIVED",
            "deviceState":"unlocked"
         },
         "recievedTimeStamp":"2016-05-12 23:29:03.663"
      },
      {  
         "response":{  
            "timestamp":"Thu May 12 23:29:08 GMT+05:30 2016",
            "status":"DISMISSED"
         },
         "recievedTimeStamp":"2016-05-12 23:30:32.161"
      }
   ]
}
PropertyDefinition
code

The code of the operation that you carried out. For example the code of the operation carried out to device info operation is DEVICE_INFO.

type

The operation type that was carried out on the device. The operations types can be one of the following:

  • COMMAND
  • PROFILE
idThe operations carried out on a device is recorded in a database table. The ID of the operation in the database table is given as the ID in the output.
status

The status of the operation that has been carried out on a device. The operation status can be any one of the following:

  • IN-PROGRESS - The operation is processing on the EMM server side and has not yet been delivered to the device.
  • PENDING - The operation is delivered to the device but the response from the device is pending.
  • COMPLETED - The operation is delivered to the device and the server has received a response back from the device.
  • ERROR - An error has occurred while carrying out the operation.
receivedTimeStampThe time WSO2 EMM received the response from the device.
createdTimeStampThe time when the operation was requested to be carried out.
isEnabledIf the assigned value is true it indicates that a policy is enforced on the device. If the assigned value is false it indicates that a policy is not enforced on a device.

activityId

The identifier used to identify the operation uniquely.
responsesThe response received by the device that contains the details of the operation you wished to get.

Getting installed application details of a device

DescriptionGet the list of applications that a device has subscribed.
Resource Path/{type}/{id}/apps
URL/mdm-admin/operations/{type}/{id}/apps
HTTP MethodGET
Request/Response Formatapplication/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-admin/operations/{type}/{id}/apps
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.
  • Define the device type as the value for {type}. Example: ios, android or windows.
  • Define the device ID as the value for {id}.

Example:

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -k -v https://localhost:9443/mdm-admin/operations/ios/f409r4c55924rt4af9a44tts15y9d6cd56h1047d/apps
 Sample output
> GET /mdm-admin/operations/ios/f409r4c55924rt4af9a44tts15y9d6cd56h1047d/apps HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a
< HTTP/1.1 200 OK
< Cache-Control: private
< Expires: Thu, 01 Jan 1970 05:30:00 IST
< Date: Thu, 18 Feb 2016 11:45:06 GMT
< Content-Type: application/json
< Content-Length: 2
< Server: WSO2 Carbon Server
[{"id":1,"platform":"ios","name":"WSO2%20Agent","isActive":"true","applicationIdentifier":"org.wso2.emm.agent"{"id":2,"platform":"ios","name":"QR%20Code%20Reader","isActive":"false","applicationIdentifier":"me.scan.ios.client"},{"id":3,"platform":"ios","name":"BasicManagedProfile","isActive":"true","applicationIdentifier":"com.example.ios.basicmanagedprofile"}]
Sample JSON Output
Definition 

The following is extracted from the sample output to get a better understanding of the fields:

 {  
   "id":1,
   "platform":"ios",
   "name":"WSO2%20Agent",
   "isActive:"true",
   "applicationIdentifier":"org.wso2.emm.agent"
}

Property Value

Description

id

The ID of the application that is installed on the device.

platform

The mobile device platform. It can be android, ios or windows.

nameThe name of the application that is installed on the device.
isActiveDefines of the application is active or inactive.
app_identifierThe application package name.

Getting pagination details for operations on a device

Description

You will carry out many operations on a device. In a situation where you wish to view the all the operations carried out on a device it is not feasible to show all the details on one page therefore the details are paginated.

Example: You carry out 21 operations via a given device. When you wish to see the operations carried out, the details of the 21 operations will be broken down into 3 pages with 10 operation details per page.

Resource Pathpagination/{type}/{id}
URL/mdm-admin/operations/paginate/{type}/{id}
HTTP MethodGET
Request/Response Formatapplication/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-admin/paginate/operation/{type}/{id}
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.
  • Define the device type as the value for {type}. Example: ios, android or windows.
  • Define the device ID as the value for {id}.

Example:

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -k -v https://localhost:9443/mdm-admin/paginate/operations/ios/f409r4c55924rt4af9a44tts15y9d6cd56h1047d

Filter the device details using the query parameters given below:

  • start - Provide the starting pagination index. Example 10

     You will have many devices registered with the EMM. In a situation where you wish to view the all the registered devices it is not feasible to show all the details on one page therefore the details are paginated.
  • length - Provide how many device details you require from the starting pagination index. For example if you require the device details from the 10th pagination index to the 15th, you must define 10 as the value for start and 5 as the value for length.

    If you wish to get the device details within a predefined index range you need to define both the start and length fields.
    Example: https://localhost:9443/mdm-admin/devices?start=10&length=5
    There will be situations were you will not have device details in the specified index range. In such situation all the details of the devices registered to EMM will be given.

 Sample output
> GET /mdm-admin/operations/paginate/ios/f409r4c55924rt4af9a44tts15y9d6cd56h1047d HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a
< HTTP/1.1 200 OK
< Cache-Control: private
< Expires: Thu, 01 Jan 1970 05:30:00 IST
< Date: Tue, 23 Feb 2016 05:23:56 GMT
< Content-Type: application/json
< Content-Length: 3785
< Server: WSO2 Carbon Server
{"recordsTotal":6,"recordsFiltered":6,"draw":0,"data":[
{"code":"DEVICE_INFO","type":"COMMAND","id":38,"status":"PENDING","receivedTimeStamp":"","createdTimeStamp":"2016-02-23 10:51:22.06","isEnabled":false},{"code":"APPLICATION_LIST","type":"COMMAND","id":37,"status":"PENDING","receivedTimeStamp":"","createdTimeStamp":"2016-02-23 10:51:20.755","isEnabled":false}]}
Sample JSON Output
Definition 
{  
   "code":"ALARM",
   "type":"COMMAND",
   "id":34,
   "status":"COMPLETED",
   "receivedTimeStamp":"2016-02-23 09:57:22.113",
   "createdTimeStamp":"2016-02-23 09:57:21.113",
   "isEnabled":false
}, 

Property Value

Description

code

The code of the operation that you carried out. For example the code of the operation carried out to ring the alarm is ALARM.

type

The operation type that was carried out on the device. The operations types can be one of the following:

  • COMMAND
  • PROFILE
idThe operations carried out on a device is recorded in a database table The ID of the operation as in this database table is given as the ID in the output.
status

The status of the operation that has been carried out on a device. The operation status can be any of the following:

  • IN-PROGRESS - The operation is processing on the EMM server side and has not yet been delivered to the device.
  • PENDING - The operation is delivered to the device but the response from the device is pending.
  • COMPLETED - The operation is delivered to the device and the server has received a response back from the device.
  • ERROR - An error has occurred while carrying out the operation.
receivedTimeStampThe time WSO2 EMM received the response from the device.
createdTimeStampThe time when the operation was requested to be carried out.
isEnabledIf the assigned value is true it indicates that a policy is enforced on the device. If the assigned value is false it indicates that a policy is not enforced on a device.

Installing an application on a device

DescriptionInstall a selected application on a device.
Resource Path/installApp/{tenantDomain}
URL/mdm-admin/operations/installApp/{tenantDomain}
HTTP MethodPOST
Request/Response Formatapplication/json
cURL command
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -d @'<JSON_PAYLOAD>' -k -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-admin/operation/installApp/{tenantDomain}
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • Define the path to the JSON file, which includes the required properties to install an application as the <JSON_PAYLOAD> value. For more information, see the Sample JSON Definition.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.
  • Provide the tenant domain as the value for {tenantDomain}. The default tenant domain of WSO2 EMM is carbon.super. For more information on adding a tenant, see Managing Tenants.

Example:

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -d @'device_id.json' -k -v https://localhost:9443/mdm-admin/operations/installApp/carbon.super
 Sample output
> POST /mdm-admin/operations/installApp/carbon.super HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a
> Content-Length: 23
< HTTP/1.1 201 Created
< Cache-Control: private
< Expires: Thu, 01 Jan 1970 06:35:00 IST
< Date: Thu, 25 Feb 2016 14:06:57 GMT
< Content-Type: application/json
< Content-Length: 80
< Server: WSO2 Carbon Server
{"statusCode": 201, "messageFromServer": "Application installation request has been sent to the device."}
Sample JSON
Definition 
[
  "2be702beaaf4ad34fc9e7f8da2b6b808c453fa72b", 
  "2ec33430ad456713c633de75b2219376bac45de56"
]

Property Value

Description

Required

Default
Value 

Data
Type

Example

device id

ID of the device. Multiple device IDs can be added by using comma separated values. 

Yes

N/A

String

2be702beaaf4ad34fc9e
7f8da2b6b808c453fa72b

Uninstalling an application from a device

DescriptionUninstall a selected application from a device.
Resource Path/uninstallApp/{tenantDomain}
URL/mdm-admin/operations/uninstallApp/{tenantDomain}
HTTP MethodPOST
Request/Response Formatapplication/json
cURL command
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -d @'<JSON_PAYLOAD>' -k -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-admin/operation/uninstallApp/{tenantDomain}
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • Define the path to the JSON file, which includes the required properties to uninstall an application from a device as the <JSON_PAYLOAD> value. For more information, see the Sample JSON Definition.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.
  • Provide the tenant domain as the value for {tenantDomain}. The default tenant domain of WSO2 EMM is carbon.super. For more information on adding a tenant, see Managing Tenants.

Example:

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -d @'device_id.json' -k -v https://localhost:9443/mdm-admin/operations/uninstallApp/carbon.super 
 Sample output
> POST /mdm-admin/operations/uninstallApp/carbon.super HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a
> Content-Length: 23
< HTTP/1.1 201 Created
< Cache-Control: private
< Expires: Thu, 01 Jan 1970 05:30:00 IST
< Date: Thu, 25 Feb 2016 11:29:30 GMT
< Content-Type: application/json
< Content-Length: 78
< Server: WSO2 Carbon Server
{"statusCode":201,"messageFromServer":"Application removal request has been sent to the device."} 
Sample JSON
Definition 
[
  "2be702beaaf4ad34fc9e7f8da2b6b808c453fa72b", 
  "2ec33430ad456713c633de75b2219376bac45de56"
]

Property Value

Description

Required

Default
Value 

Data
Type

Example

device id

ID of the devices. Multiple device IDs can be added by using comma separated values. 

Yes

N/A

String

2be702beaaf4ad34fc9e
7f8da2b6b808c453fa72b

  • No labels