I've created a device on Watson IoT Plattform online dashboard. This device published data using Basic authentication with use-token-auth and its password:
URL: https://noz238.messaging.internetofthings.ibmcloud.com:8883/api/v0002/device/types/Light/devices/TestLight/events/status
Method: POST
Body: {"isOn":false}
This send body is visible on the latest events view on https://noz238.internetofthings.ibmcloud.com/dashboard/devices/browse
I have problems to get the latest state / event of this device using this REST API (and with an API key for visualizations). I did got unexpected responses trying different api's
I tried this endpoint: https://noz238.internetofthings.ibmcloud.com/api/v0002/device/types/Light/devices/TestLight/events (https://docs.internetofthings.ibmcloud.com/apis/swagger/v0002/info-mgmt.html#/Last%20Event%20Cache/get_device_types__deviceType__devices__deviceId__events)
Answer: RC: 403
{
"message": "CUDCS0106E: <missing messageId in bundle com.ibm.wiotp.util.httpservice.nls.servicemessages>",
"exception": {
"id": "CUDCS0106E",
"properties": [
"noz238"
]
}
}
And I tried this endpoint: https://noz238.internetofthings.ibmcloud.com/api/v0002/device/types/Light/devices/TestLight/state/test (https://docs.internetofthings.ibmcloud.com/apis/swagger/v0002/state-mgmt.html#/Devices/get_device_types__typeId__devices__deviceId__state__logicalInterfaceId_)
Answer: RC: 404
{
"message": "CUDIM0001E: No 'Device Type' with id 'Light' could be found in org 'noz238'",
"exception": {
"id": "CUDIM0001E",
"properties": [
"noz238",
"Light",
"Device Type"
]
}
}
How can I get the latest event / state of a device?