Closed Zouz83 closed 10 years ago
It's probably just a problem with address; try using host dashboard.us.enableiot.com. The request URL should then be:
https://dashboard.us.enableiot.com/v1/api/accounts/9ccc...{your account ID}/data/search
Wiki page covering data API: https://github.com/enableiot/iotkit-api/wiki/Data-API
If you still experience this problem, please paste the full API request.
thanks jrozestw I tryed now in my terminal curl https://dashboard.us.enableiot.com/v1/api/accounts/9ccc.../data/search -H 'Authorization: Bearer HeTS5q4M' Unauthorized 9ccc.... is the account ID where my galileo is sending data too HeTS5q4M is the activation code that i got from my account details am i missing something?
In the Authorization header you must provide your user JWT token. You can obtain your user token as explained here: https://github.com/enableiot/iotkit-agent/wiki/Authorization-API
What you'll need:
Authorization: Bearer eyJ0eXAi...
Replace the accountId, deviceId and componentID and then POST.
POST accounts/{accountId}/data/search
{
"from": 0,
"targetFilter": {
"deviceList": [
"<device ID>"
]
},
"metrics": [
{
"id": "<component_id>",
"op": "none"
}
]
}
If you'd like to see Python or Node.js examples of how to do this, please see:
https://github.com/enableiot/iotkit-samples/tree/master/api
--Patrick
somewhere i still don't get that to work my call is:
curl -g https://dashboard.us.enableiot.com/v1/api/accounts/9ccc.../data/search -H 'Authorization: Bearer eyJ0eXAiOiJKV1Q...' --data '{"from": 0,"targetFilter": {"deviceList": ["00...."]}, "metrics": [{"id": "f659....", "op": "none"}]}'
{"code":400,"message":"Invalid request","errors":["targetFilter is missing and it is required","metrics is missing and it is required"," undefinedThe property {\"from\":0,\"targetFilter\":{\"deviceList\": is not defined in the schema and the schema does not allow additional properties"]}
I will continue looking and hopefully get that to work on objective c later on. Thanks a lot
Finally for it to work i had to add the header -H 'Content-type: application/json' For the ones who want to try curl is: curl -g https://dashboard.us.enableiot.com/v1/api/accounts/{AccountID}/data/search -H 'Authorization: Bearer {Token here}' -H 'Content-type: application/json' -X POST --data '{"from":0,"targetFilter":{"deviceList":["{DeviceID}"]},"metrics":[{"id":"{here ID of the sensor}","op":"none"}]}'
Hi, I'm trying to find how to get the JSON data from my device. Could someone tell me if there is a way to do it by simple REST call like this api: http://api.openweathermap.org/data/2.5/forecast/daily?lat=1.350069&lon=103.696728&units=metric&cnt=7
i tryed that: https://enableiot.com/v1/api/accounts/9ccc...{my account ID}/data/search an i get error 404 Not found.
that would be usefull for calling the api from a device like a phone only get data no put or delete.
Thanks