2
votes

I want to use IoT Agent JSON (https://github.com/telefonicaid/iotagent-json) with HTTP transport protocol instead of MQTT. Is it possible? How can I do it?

Thanks!

2

2 Answers

0
votes

Yes, you cand o it, just follow the new github README secion where HTTP transport option is explained.

Cheers,

0
votes

You only need a contiguration/template for all your devices. Such a configuration must specify the protocol is IoTA-JSON and the transport is HTTP. The request is sent to the nothbound interface of the Json IoT agent:

POST http://iota_host:iota_port/iot/services
Fiware-Service: <service>
Fiware-ServicePath: <subservice>

{
   "services": [
      {
         "entity_type": "<default_entity_type>",
         "protocol": "IoTA-JSON",
         "transport": "HTTP",
         "apikey": "<api_key>",
         "attributes": [ "<common_active_attrs_if_any>" ],
         "lazy": [ <common_lazy_attrs_if_any> ],
         "commands": [ <common_commands_if_any> ],
         "static_attributes": [ <common_static_attrs_if_any> ]
      }
   ]
}

After that, you will be able to provision Json-based devices using Http transport:

POST http://iota_host:iota_port/iot/devices
Fiware-Service: <service>
Fiware-ServicePath: <subservice>

{
   "devices": [
      {
         "device_id": "<device_id>",
         "entity_name": "<entity_name>",
         "entity_type": "<alternative_entity_type>",
         "attributes": [ <additional_active_attrs_if_any> ],
         "lazy": [ <additional_lazy_attrs_if_any> ],
         "commands": [ <additional_commands_if_any> ],
         "static_attributes": [ <additional_static_attrs_if_any> ]
      }
   ]
}

Even, you could create a configuration/template without specifying the transport, i.e. the configuration/template will only relate to all the Json-based agents, independently of their transport, and then when provisioning a Json-based device, specify the transport.