Mohammad Eskandari
Mohammad Eskandari

Reputation: 27

retrieve historical IoT data bluemix

I tried to retrieve historical data of my Internet of Things Foundation devices using CURL command. So I executed this command:

curl -v -X GET -H "Authorization:Basic api_key:auth_token" -H "Content-Type: application/json" -H "Accept: application/json" http://[ogrId].messaging.internetofthings.ibmcloud.com/api/v0002/historian/[ogrId]/types/[type]/devices/[mac add]?top=10

But I could not access the data!

Upvotes: 1

Views: 354

Answers (1)

Paul Slater
Paul Slater

Reputation: 451

A few problems with your curl command:

1) It looks like you are setting the basic auth header without encoding it using RFC2045-MIME. With curl you don't need to set the header yourself, you can simply use the -u option, eg:

curl -u "username:password" ....

2) You are using http instead of https.

3) The URL is not quite right - you should not have orgID in the path.

The command should probably be more like:

curl -v -X GET -u "api_key:auth_token" https://[orgId].messaging.internetofthings.ibmcloud.com/api/v0002/historian/types/[type]/devices/[mac add]?top=10

Upvotes: 1

Related Questions