Saravana Kumar
Saravana Kumar

Reputation: 1

How to extract the event data using HTTP API from IBM watson device

I have the ibm Watson account and connected my labview device to the IBM cloud. I need to extract the data which I sent from labivew in order to view the data in MIT app inventor. I am able to get the location, timestamp and other information like events, but not able to get the raw event data.

URL used for location: https://<org_id>.internetofthings.ibmcloud.com/api/v0002/device/types/<devicetype>/devices/<deviceid>/location

Result:

{  
   "longitude":0.0,
   "latitude":0.0,
   "elevation":0.0,
   "accuracy":0.0,
   "measuredDateTime":"2016-08-24T16:47:42.393Z",
   "updatedDateTime":"2019-01-28T18:17:07+00:00"
}

Similarly how to get the data which is posted via event. When I trying to access the data, an Access denied error is displayed. I am not sure how to enter my api-key for authentication and other access.

Upvotes: 0

Views: 377

Answers (1)

DavidParker
DavidParker

Reputation: 358

I am assuming you are trying to access the last event cache via API, rather live live streaming of real time events over MQTT?

It’s that is the case, and you are getting a http 403 response then most likely I would suspect that you have not enabled the last event cache feature in your settings. By default the last event cache is disabled.

Ref: https://ibm-watson-iot.github.io/iot-python/application/api/lec/

Last Event Cache is an optional feature in Watson IoT Platform, which when enabled allows the caching of the last event sent for each eventId by each registered device. By default this feature is disabled, to use this feature you must enable it from your dashboard at https://MYORGID.internetofthings.ibmcloud.com/dashboard/settings.

After you have enabled the LEC feature you should be able to get the cached event via the API at:

https://<org_id>.internetofthings.ibmcloud.com/api/v0002/device/types/<devicetype>/devices/<deviceid>/events

Or, if you want a specific event: https://<org_id>.internetofthings.ibmcloud.com/api/v0002/device/types/<devicetype>/devices/<deviceid>/events/<eventid>

Upvotes: 1

Related Questions