Skip to content

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

@shanerenshawaus

Description

@shanerenshawaus

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

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions