devicehive / devicehive-java-server

DeviceHive Java Server
http://www.devicehive.com
Apache License 2.0
364 stars 137 forks source link

Executing GET /device/{id} endpoint more than one time results in null fields ins results #107

Closed demon-xxi closed 8 years ago

demon-xxi commented 8 years ago

There is some issue at least with GET /device/{id} endpoint (other may be also affected). When I call it first time I get a result with device and it's network and class information.

{
    "id": "test-device-2",
    "name": "test-device-2",
    "status": null,
    "data": null,
    "network": {
      "id": 2,
      "key": null,
      "name": "Sample network for sergey@devicehive.com",
      "description": "Playground Network"
    },
    "deviceClass": {
      "id": 14,
      "name": "default device",
      "version": "1.0",
      "isPermanent": false,
      "offlineTimeout": null,
      "data": null,
      "equipment": []
    },
    "isBlocked": null
  }

All the subsequent calls result in an empty data fields:

{
  "id": "test-device-2",
  "name": "test-device-2",
  "status": null,
  "data": null,
  "network": {
    "id": null,
    "key": null,
    "name": null,
    "description": null
  },
  "deviceClass": {
    "id": null,
    "name": null,
    "version": null,
    "isPermanent": null,
    "offlineTimeout": null,
    "data": null,
    "equipment": null
  },
  "isBlocked": null
}

Perhaps this is something related to lazy load or data caching. Here's the request I used for this test.

curl -X GET --header "Accept: application/json" --header "Authorization: Bearer hS5FpwGULLGo9wjodccZUUGaexiuvlmJ4SAE7Dyx9QI=" "http://playground.devicehive.com/api/rest/device/test-device-2"
zubrabubra commented 8 years ago

After short investigation. Problem affects users / sessions used key auth to access device hive.

demon-xxi commented 8 years ago

deployed to playground.devicehive.com