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
58 stars 84 forks source link

add multiple delete of devices #1579

Closed AlvaroVega closed 4 months ago

AlvaroVega commented 4 months ago

issue https://github.com/telefonicaid/iotagent-node-lib/issues/1578

fgalan commented 4 months ago

A delete method with body is not fully restful but is not so ilegal, but we can look for other methods. @fgalan what do you think?

It is not illegal, but not sure if some network middleware (proxies, etc.) could have issues with this. Maybe it's better to avoid this risk using another approach.

Maybe we could use POST /iot/op/delete. This makes explicit that we are not using a REST operation (as we are not acting on a given resource, i.e. a device in IOAT API terms) but a kind of RPC operation (this is similar to the approach used in Orion API with the POST /v2/op operations family).

AlvaroVega commented 4 months ago

A delete method with body is not fully restful but is not so ilegal, but we can look for other methods. @fgalan what do you think?

It is not illegal, but not sure if some network middleware (proxies, etc.) could have issues with this. Maybe it's better to avoid this risk using another approach.

Maybe we could use POST /iot/op/delete. This makes explicit that we are not using a REST operation (as we are not acting on a given resource, i.e. a device in IOAT API terms) but a kind of RPC operation (this is similar to the approach used in Orion API with the POST /v2/op operations family).

Taking a look to resource already used by device API:

https://github.com/telefonicaid/iotagent-node-lib/blob/7320146646757b6f39bdd0db052d1ca670e4f295/lib/services/northBound/deviceProvisioningServer.js#L438-L468

I was looking for something like POST /iot/devices/delete

fgalan commented 4 months ago

I understand (as seen in commit 9752b31efec19c2cc51726948d33189e3e48b2e2) that at the end we are going to use POST /iot/op/delete.