Open cdupont opened 6 years ago
Usually PUT is for modifying an existing resource, POST is for creating a new one. For instance modifying the name attribute in Orion is:
PUT http://orion:1026/v2/entities/MySensor/attrs/name -d MySensor
while adding the name attribute is:
POST http://orion:1026/v2/entities/MySensor/attrs -d {id: name, value:MySensor}
However adding both methods in the API seems too much...
@henokzion any idea? A solution could be to add a default or null value to the "name" attribute upon creating the sensor...
OK I put some default values when creating the sensors for name, owner, domain, gateway_id and location: https://github.com/Waziup/api-server/commit/99efe41f87f359b8486dd6b7d4c34731c64e3050 So now it should be possible to perform a PUT on them.
Putting the default name is a good Idea. I will test it now
@henokzion did you test?
When trying to add a name to a sensor without a name: