I'm developing a Fiware
system and I don't know how to send measures from a device through IDAS
iot-agent
.
I have Orion and Cygnus running, but I'm sending the measures with a servlet directly to Orion and I want to switch the proccess to IDAS iot-agent
.
I've created the service and the device properly but I'm stucked with the POST from the device to the iot-agent.
My device is created as follows:
{ "device_id" : "0010", "entity_name" : "0010", "entity_type" : "xxxxx", "timezone" : "Europe/Madrid", "attributes" : [ { "object_id" : "0010", "name" : "fecha", "type" : "timestamp", "name" : "coord_x", "type" : "double", "name" : "coord_y", "type" : "double", "name" : "coderr", "type" : "string", "name" : "s_temp", "type" : "double", "name" : "s_hum", "type" : "double", "name" : "num_sat", "type" : "int", "name" : "voltaje", "type" : "double", "name" : "inicio", "type" : "int" } ], "service" : "xxxxx", "service_path" : "/xxxxx" }
How it would be the POST from the device to send the measures?
Thanks.
EDIT:
I tried to POST from a command line to test like this:
curl -X POST xxxxxxxxxxxx:8080/iot/d?i=0010 \ -i \ -H "Content-Type: application/text" \ -H "Fiware-Service: xxxxxx" \ -H "Fiware-ServicePath: /xxxxxx" \ -d "s_temp|25"
And here is the response:
HTTP/1.1 415 Connection: close Content-Length: 88 {"reason": "Unsupported Media Type (only support application/xml and application/json)"}
Now the question is... if I had installed iot-agent-base and iot-agent-ul, Why I'm not able to POST text? Did I miss some configuration?
EDIT:
I'm able to send values to this url:
http://xxxxxxxx:8080/iot/xx?k=xxxxxxx&i=xxxxxxxx#fecha|1#coord_x|1#coord_y|1#coderr|1#s_temp|1#s_hum|1#s_temp|1#num_sat|1#voltaje|1#inicio|1
And this is the respone
DEBUG - Accept: */*
DEBUG - End filters status 200
DEBUG - Proccessing in handle /iot
DEBUG - iota::AdminService::error_response 0
DEBUG - finish connection 2
DEBUG - Get statistics /iot/ngsi Counters 0
INFO - Agent Activity {"statistics":[{"resource":"/iot/ngsi","data":[]}]}
But Orion doesn't get anything
EDIT:
It was a version issue, now I have the latest version of iot-agent installed with UltraLight module and device with "protocol":"PDI-IoTA-UltraLight" and the protocol itself is working.
But I don't know what is the correct url to post measures from the device. Any help?
Have you tried the same URL you were trying before but with -H "Content-Type: application/json" ?
Even when the body is UL2.0 the content-type should be set to JSON.
Let me know if this fix your problem. Thanks for using IDAS!