Snipe-it: Unable to get more than 500 results via API

Created on 4 Sep 2019  路  4Comments  路  Source: snipe/snipe-it

Describe the bug
This morning I was able to get all my 1000+ items via API, now after the update I'm only able to get 500.

To Reproduce
This query will only get 500 results even if the limit is set to 1000000

curl --request GET \
  --url 'https://snipeiturl/api/v1/hardware?limit=1000000&offset=0&sort=created_at&order=desc' \
  --header 'accept: application/json' \
  --header 'authorization: Bearer xxxxxxx' \
  --header 'content-type: application/json'

Expected behavior
Get all the results up to "limit".

Screenshots
There is no need.

Server (please complete the following information):

  • Snipe-IT Version: v4.7.7 build 4160 (gb8f7cd81e)
  • OS: Ubuntu 18.04.3 LTS
  • Web Server: Apache
  • PHP Version: 7.2.19

Desktop (please complete the following information):
Not applicable.

Smartphone (please complete the following information):
Not applicable.

Error Messages
No errors, just few results than expected.

Additional context
I've found this in config/app.php:

    |--------------------------------------------------------------------------
    | Result Limit
    |--------------------------------------------------------------------------
    |
    | This value determines the max number of results to return, even if a higher limit
    | is passed in the API request. This is done to prevent server timeouts when
    | custom scripts are requesting 100k assets at a time.
    |
    */

    'max_results' => env('MAX_RESULTS', 500),

I suspect this is related to this issue.

Thanks,
Matteo

not a bug

All 4 comments

I mean, it literally says that in the update notes: https://github.com/snipe/snipe-it/releases/tag/v4.7.7

"The maximum number of items returned is now capped at 500 by default. This is to prevent server timeouts and memory issues when someone (usually a custom script) naively tries to request 100k items at one time. You can increase this limit by adding MAX_RESULTS to your .env file and setting that value to a higher number. Otherwise you should use standard pagination using the offset parameter to get your complete data set."

GitHub
A free open source IT asset/license management system - snipe/snipe-it

Shame on me for this!
I've read almost anything before posting this issue... but not the release notes! Sh*t!

Thanks for pointing me in the right direction.

Cheers,
Matteo

Dear All, I set the MAX_RESULTS=700 in my .env file, I set the same value in app.php file and in GUI (Admin-> General Settings-> Rows per page), but this value is not relfected in dropdown button of "Assets-> List All" page. It is still showing 500 as maximum value and a list of 500 items. Where is my error? I cleared config using artisan, but nothing changed. Any suggestion about this? I'm using the latest version of Snipeit. Thanks

Additional info about my issue: MAX_RESULTS=700 is reflected correctly on "asset maintenance report" page. The problem still persists on "asset list" page.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

snipe picture snipe  路  3Comments

snipe picture snipe  路  5Comments

ericdude101 picture ericdude101  路  5Comments

sopheaouk picture sopheaouk  路  3Comments

Supsuop picture Supsuop  路  4Comments