devicehive-java-server
devicehive-java-server copied to clipboard
Error 401: "Device with such guid = unique-device-name not found"
When trying to create device with same id existing for another user - the following error is thrown:
{
"error": 401,
"message": "Device with such guid = unique-device-name not found"
}
while it gives correct 401 code the message is misleading. At minimum, let's change it to something like "Device with guid='xyz_abc' is not available to this user."
But for future we need a better way to handle unique device ids for multi-tenancy case. Ideally have a unique device id/name only within same network.
Issue can be reproduced with the curl:
curl -X PUT \
-H "Authorization: Bearer INSERT_YOUR_ACCESS_TOKEN_BEFORE_CALL=" \
-H "Content-Type: application/json" \
-d '{"name" : "unique-device-name", "deviceClass": {"name" : "default device", "version": "1.0"}}' \
'http://playground.devicehive.com/api/rest/device/unique-device-name'