Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API calls not respecting limit paramater when set to 0 #7209

Closed
shanerenshawaus opened this issue Sep 8, 2021 · 1 comment
Closed

API calls not respecting limit paramater when set to 0 #7209

shanerenshawaus opened this issue Sep 8, 2021 · 1 comment
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@shanerenshawaus
Copy link

NetBox version

v3.0.1

Python version

3.9

Steps to Reproduce

  1. Set MAX_PAGE_SIZE=0
  2. ensure you have an object type that has enough entries to reproduce
  3. make an api call that has the limit=0 flag eg https://netbox/api/dcim/devices/?limit=0

Expected Behavior

The API should return all objects from the query with no next value eg:

GET /api/dcim/devices/?limit=10000

HTTP 200 OK
Allow: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "count": 6672,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 2902,
            ....
       } ,
      ...
   ]
}

Note, the limit above was used to simulate what is expected to respond.

Observed Behavior

The API returns the result with the default pagination (50 for us):

GET /api/dcim/devices/?limit=0

HTTP 200 OK
Allow: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "count": 6672,
    "next": "https://netbox/api/dcim/devices/?limit=50&offset=50",
    "previous": null,
    "results": [
        {
            "id": 2902,
            ....
       } ,
      ...
   ]
}

Setting the limit paramater to any other value returns succesfully, eg if we set it to 10,000 it will return all 6672 objects

@shanerenshawaus shanerenshawaus added the type: bug A confirmed report of unexpected behavior in the application label Sep 8, 2021
@shanerenshawaus shanerenshawaus changed the title API calls not respecting limit=0 paramater API calls not respecting limit paramater when set to 0 Sep 8, 2021
@jeremystretch jeremystretch added the status: accepted This issue has been accepted for implementation label Sep 8, 2021
@jeremystretch jeremystretch self-assigned this Sep 8, 2021
@jeremystretch
Copy link
Member

Related to #7101

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

2 participants