telefonicaid / iotagent-node-lib

Module to enable IoT Agent developers to build custom agents for their devices that can easily connect to NGSI Context Brokers
https://iotagent-node-lib.rtfd.io/
GNU Affero General Public License v3.0
60 stars 85 forks source link

APPEND api call #547

Open ascatox opened 7 years ago

ascatox commented 7 years ago

When I try to UPDATE a new attribute in my ngsi context, I encounter 407 error from Orion Context Broker (offending attribute). I can't find in this version of the library an api call for APPEND mode for Orion POST. I find only this piece of code inside ngsiService.js: if (config.getConfig().appendMode) { payload.updateAction = 'APPEND'; } else { payload.updateAction = 'UPDATE'; } This piece of code uses a system environment variable to set in OS, not too comfortable in developer environments. Is it possible to have a different api function alternative to update()?

BR Antonio.

frbattid commented 7 years ago

@ascatox , if the issue applies to Orion Context Broker then, please, post it at https://github.com/telefonicaid/fiware-orion

Thanks!

ascatox commented 7 years ago

It's not an issue on OCB, it's not an issue, it's a lack of functionality. In this library lacks an append() function to post data in APPEND mode inside OCB, alternative to update(). BR.

frbattid commented 7 years ago

I did not see you were referring to this library, my apologies.

IoTAs, and this library in particular, expose a north provisioning interface for device creation, retrieval, removal and update. The idea is when you provision a device in the IoTA (directly, or through the IoTA Manager), an entity is automatically created in Context Broker.

Being said that, the south interface of the IoTAs is designed to only accept measures and command execution results from the devices. Thus, if a new attribute comes into play, and you provide values for that new attribute via an IoTA, a new attribute will not be appended at Context Broker; simply, this information will be droped.

In order to accept data regarding new attributes, first you'll have to use the above mentioned provisioning interface of the IoTAs, in particular the update device operation, in order to provision such new attribute; that will automatically append a new attribute to the entity at Context Broker level. From here on, values for the new attribute sent to the IoTA will be updated in Context Broker.

ascatox commented 7 years ago

Thank you for your explanation. I didn't understand how to append attributes, but now is clear: update device with new attributes then update the values of these attributes.

Sorry again for inserting this bug. BR, Antonio.