Is there a limit on API calls?

Hi

I’m trying to retrieve a list of all devices from a project in a html widget in the dashboard.
Currently, i’m doing this via first retreiving all the devices on a user, and then filtering on a project (as there is no API call for calling all devices from a project directly?).

But while doing this, it seems that the response is limited to 50 devices. Is this correct? Is there a workaround or a better way to do this?

Thanks in advance!
Gus

Hi,

I remember that there were limitations regarding the amount of items sent by the api requests, according that experience it is correct, I had the same question when was retrieving items from a bucket and in that moment the limitation was up to 200 items, the workaround was to sort a way to make the calls to retrieve 200 items each time if were required more than 200.

Hope this helps.

Hi - how did you retreive multiple calls with different information? because i tried with ?page=2 after the API call, but that didn’t give a result.

Thanks, Gus

Hi @gus

By default there is a limit of 50 to avoid overloading the server and database as well as sending large responses.

However you can use a query parameter called count to retrieve as many devices as you desire:

https://<instance>.thinger.io/v1/users/<user>/devices?name=&count=1000

If the number of device to query is large, we recommend paginating the request with an additional parameter named index:

https://<instance>.thinger.io/v1/users/<user>/devices?name=&count=50&index=0
https://<instance>.thinger.io/v1/users/<user>/devices?name=&count=50&index=50
https://<instance>.thinger.io/v1/users/<user>/devices?name=&count=50&index=100
...

Regards

Thanks! Works like this. Good to know the paginating as well!
Gus