com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_link3' is unknown.

Event Publishing API Guide

This section provides the details of the REST APIs used to publish and get details of events received by the WSO2 EMM Android client.

Publishing Events

Description

Publish events revceived by the WSO2 EMM Android client to WSO2 DAS using this API.

Resource Path/
URL/mdm-android-agent/events/
HTTP MethodPOST
Request/Response Formatapplication/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/events/ 
  • 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 publish an event 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.

Example:

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer d869e4c177f17143748376d54633473" -k -d @'event.json' -v https://localhose:9443/mdm-android-agent/events/
 Sample output
> POST /mdm-android-agent/events/ HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Authorization: Bearer 988f0b0688dce337cd64dfeb899f4cb1
> Content-Type: application/json
> Cache-Control: no-cache
> Content-Length: 154
< HTTP/1.1 201 Created
< Date: Sun, 01 May 2016 08:40:58 GMT
< Content-Type: application/json
< Content-Length: 51
< Server: WSO2 Carbon Server
{"responseCode":"Event is published successfully."}
Sample JSON Definition 
{  
   "deviceIdentifier":"353863072233137",
   "payload":"{\"packageName\":\"org.wso2.emm.agent\",\"state\":\"removed\"}",
   "type":"APPLICATION_STATE"
}
PropertyDefinition
deviceIdentifier

Defines the device ID. For more information, see Retrieving a Device ID.

payload

Defines the payload to publish the events to WSO2 DAS.

typeDefine the type of the events being published.

Getting Event Details of a device

DescriptionGet the event details received by an Android device using this API.
Resource Path

/{deviceIdentifier}

URLmdm-android-agent/events/{deviceIdentifier}
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-android-agent/events/{deviceIdentifier}
  • 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 device ID as the value for {deviceIdentifier}. For more information, see Retrieving a Device ID.

Example: Retrieve event details that corresponds to the Android device having the 359298055243973 device ID.

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer d869e4c177f17143748376d54633473"-k -v https://localhose:9443/mdm-android-agent/events/359298055243973
 Sample output
> GET /mdm-android-agent/events/352317052330505 HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer ee189258cea79c86d7656235f30e231d
> 
< HTTP/1.1 200 OK
< Date: Sun, 01 May 2016 05:31:07 GMT
< Content-Type: application/json
< Content-Length: 476
< Server: WSO2 Carbon Server
[{"values":{"_version":"1.0.0","payload":"{\"packageName\":\"com.google.android.apps.docs\",\"state\":\"dataCleared\"}","type":"APPLICATION_STATE",
"deviceIdentifier":"352317052330505"},"id":"f0c867ac-8d49-340f-aed4-ae3a34e7ec3c"},{"values":{"_version":"1.0.0","payload":"{\"packageName\":\"system_server\",\"cpu\":11,\"pid\":2436,\"pss\":0,\"sharedDirty\":0,\"uss\":0}","type":"RUNTIME_STATE",
"deviceIdentifier":"352317052330505"},"id":"b65a65c5-23f9-3258-83be-1745f4d8e0ae"}]
Sample JSON Output Definition 
[  
   {  
      "values":{  
         "_version":"1.0.0",
         "payload":"{\"packageName\":\"com.google.android.apps.docs\",\"state\":\"dataCleared\"}",
         "type":"APPLICATION_STATE",
         "deviceIdentifier":"352317052330505"
      },
      "id":"f0c867ac-8d49-340f-aed4-ae3a34e7ec3c"
   },
   {  
      "values":{  
         "_version":"1.0.0",
         "payload":"{\"packageName\":\"system_server\",\"cpu\":11,\"pid\":2436,\"pss\":0,\"sharedDirty\":0,\"uss\":0}",
         "type":"RUNTIME_STATE",
         "deviceIdentifier":"352317052330505"
      },
      "id":"b65a65c5-23f9-3258-83be-1745f4d8e0ae"
   }
]
PropertyDefinition
values

Provides the details of the event.

_version

The version of the event stream. The default value is 1.0.0.

payloadDefines the payload that was received.
typeThe type of alert or event that was received.
deviceIdentifierThe Android device ID.
idThe ID of the respective event stream.

Getting Event Details for a Given Time Period

DescriptionGet the event details of a device for a given time duration using this API.
Resource Path/{deviceIdentifier/date?from={unixTimestamp}&to={unixTimestamp)
URL/mdm-android-agent/events/{deviceIdentifier}/date?from={unixTimestamp}&to={unixTimestamp}
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-android-agent/events/{deviceIdentifier}/date?from={unixTimestamp}&to={unixTimestamp}
  • 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 device ID as the value for {deviceIdentifier}. For more information, see Retrieving a Device ID.
  • Provide the time and date format in the unix/epoch format as the value for {unixTimestamp}. Use the Epoch convertor, to convert the time and date to this format.

Example: Retrieve event details that corresponds to the Android device where the device identifier is 352317052330505 within the 1462108907 and 1462108930 time period.

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 5747a79c4ec8d7445aa622463031d299" -k -vhttp://localhost:9443/mdm-android-agent/events/352317052330505/date?from=1462108907&to=1462108930
 Sample output
> GET /mdm-android-agent/events/352317052330505/date?from=1462108907&to=1462108930 HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer ee189258cea79c86d7656235f30e231d
> 
< HTTP/1.1 200 OK
< Date: Sun, 01 May 2016 05:55:56 GMT
< Content-Type: application/json
< Content-Length: 476
< Server: WSO2 Carbon Server
[{"values":{"_version":"1.0.0","payload":"{\"packageName\":\"com.google.android.apps.docs\",\"state\":\"dataCleared\"}",
"type":"APPLICATION_STATE","deviceIdentifier":"352317052330505"},"id":"f0c867ac-8d49-340f-aed4-ae3a34e7ec3c"},{"values":{"_version":"1.0.0","payload":"{\"packageName\":\"system_server\",\"cpu\":11,\"pid\":2436,\"pss\":0,\"sharedDirty\":0,\"uss\":0}","type":"RUNTIME_STATE",
"deviceIdentifier":"352317052330505"},"id":"b65a65c5-23f9-3258-83be-1745f4d8e0ae"}]
Sample JSON Output Definition 
 [{
	"values": {
		"_version": "1.0.0",
		"payload": "{\"packageName\":\"com.google.android.apps.docs\",\"state\":\"dataCleared\"}",
		"type": "APPLICATION_STATE",
		"deviceIdentifier": "352317052330505"
	},
	"id": "f0c867ac-8d49-340f-aed4-ae3a34e7ec3c"
}, {
	"values": {
		"_version": "1.0.0",
		"payload": "{\"packageName\":\"system_server\",\"cpu\":11,\"pid\":2436,\"pss\":0,\"sharedDirty\":0,\"uss\":0}",
		"type": "RUNTIME_STATE",
		"deviceIdentifier": "352317052330505"
	},
	"id": "b65a65c5-23f9-3258-83be-1745f4d8e0ae"
}]
PropertyDefinition
values

Provides the details of the event.

_version

The version of the event stream. The default value is 1.0.0.

payloadDefines the payload that was received.
typeThe type of alert or event that was received.
deviceIdentifierThe Android device ID.
idThe ID of the respective event stream.

Getting Specific Event Details of a Device

DescriptionThe WSO2 EMM Android client receives different events. Using this API you are able to get the details of the events that belong to a specific event type.
Resource Path/{deviceidentifier}/type/{type}
URL

/mdm-android-agent/events/{deviceidentifier}/type/{type}

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-android-agent/events/{deviceidentifier}/type/{type}
  • 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 APPLICATION_STATE or RUNTIME_STATE as the value for {type}.

Example: Retrieve event details that corresponds to the Android device having the 352317052330505 device ID and alert/event type APPLICATION_STATE.

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer d869e4c177f17143748376d54633473" -k -v https://localhose:9443/mdm-android-agent/events/352317052330505/type/APPLICATION_STATE
 Sample output
> GET /mdm-android-agent/events/352317052330505/type/APPLICATION_STATE HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer 41e1e511fade79cfe01282fc6a26e3e6
> 
< HTTP/1.1 200 OK
< Date: Sun, 01 May 2016 07:37:18 GMT
< Content-Type: application/json
< Content-Length: 230
< Server: WSO2 Carbon Server
[{"values":{"_version":"1.0.0","payload":"{\"packageName\":\"com.google.android.apps.docs\",\"state\":\"dataCleared\"}",
"type":"APPLICATION_STATE","deviceIdentifier":"352317052330505"},"id":"f0c867ac-8d49-340f-aed4-ae3a34e7ec3c"}]
Sample JSON Output Definition 
 [{
	"values": {
		"_version": "1.0.0",
		"payload": "{\"packageName\":\"com.google.android.apps.docs\",\"state\":\"dataCleared\"}",
		"type": "APPLICATION_STATE",
		"deviceIdentifier": "352317052330505"
	},
	"id": "f0c867ac-8d49-340f-aed4-ae3a34e7ec3c"
}]
PropertyDefinition
values

Provides the details of the event.

_version

The version of the event stream. The default value is 1.0.0.

payloadDefines the payload that was received.
typeThe type of alert or event that was received.
deviceIdentifierThe Android device ID.
idThe ID of the respective event stream.

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.