chirpstack / chirpstack-rest-api

ChirpStack gRPC API to REST proxy.
MIT License
17 stars 14 forks source link

Empty result on get requests v4.0.2 #6

Closed Korny666 closed 2 years ago

Korny666 commented 2 years ago

When I try to get my apps or devices etc.. I get the right count but an empty result...

curl -X 'GET' \
  'http://<IP>:8090/api/devices?applicationId=<APPID>' \
  -H 'accept: application/json' \
  -H 'Grpc-Metadata-Authorization: Bearer <API-TOKEN>'
{
  "totalCount": 2,
  "result": []
}
t-huyeng commented 2 years ago

As far as I know you have to specify the limit parameter as well. You can set it to 10 for example:

curl -X 'GET' \
  'http://<IP>:8090/api/devices?limit=10&applicationId=<APPID>'  \
  -H 'accept: application/json' \
  -H 'Grpc-Metadata-Authorization: Bearer <API-TOKEN>'
{
  "totalCount": 2,
  "result": [
    {
      "devEui": "<devEui>",
      "createdAt": "2022-02-01T10:18:21.093435Z",
      "updatedAt": "2022-02-01T10:18:21.093435Z",
      "lastSeenAt": "2022-10-28T17:23:44.801669Z",
      "name": "<name>",
      "description": "...",
      "deviceProfileId": "...",
      "deviceProfileName": "...",
      "deviceStatus": {
        "margin": 27,
        "externalPowerSource": true,
        "batteryLevel": -1
      }
    },
    .....
    .....
    }
  ]
}

see also #2

t-huyeng commented 2 years ago

@Korny666 did this solve your issue?

Korny666 commented 2 years ago

@t-huyeng Thanks for the hint. it did.