mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-28 11:47:35 +02:00
Merge branch 'main' into feature
This commit is contained in:
@@ -34,7 +34,7 @@ NetBox ships with a reasonable default configuration for most environments, but
|
||||
|
||||
#### Reduce the Maximum Page Size
|
||||
|
||||
NetBox paginates large result sets to reduce the overall response size. The [`MAX_PAGE_SIZE`](../configuration/miscellaneous.md#max_page_size) parameter specifies the maximum number of results per page that a client can request. This is set to 1,000 by default. Consider lowering this number if you find that API clients are frequently requesting very large result sets.
|
||||
NetBox paginates large result sets to reduce the overall response size. The [`MAX_PAGE_SIZE`](../configuration/miscellaneous.md#max_page_size) parameter specifies the maximum number of results per page that a client can request. This is set to 1,000 by default. Consider lowering this number if you find that API clients are frequently requesting very large result sets. `MAX_PAGE_SIZE` applies to both the REST API (`?limit=`) and the GraphQL API (`pagination: {limit: …}`), so lowering it reduces the maximum size of responses from either API.
|
||||
|
||||
#### Limit GraphQL Aliases
|
||||
|
||||
@@ -185,3 +185,5 @@ Like the REST API, the GraphQL API supports pagination. Queries which return a l
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The requested `limit` is capped by [`MAX_PAGE_SIZE`](../configuration/miscellaneous.md#max_page_size).
|
||||
|
||||
@@ -45,7 +45,7 @@ Sets content for the top banner in the user interface.
|
||||
|
||||
!!! tip
|
||||
If you'd like the top and bottom banners to match, set the following:
|
||||
|
||||
|
||||
```python
|
||||
BANNER_TOP = 'Your banner text'
|
||||
BANNER_BOTTOM = BANNER_TOP
|
||||
@@ -188,7 +188,9 @@ This specifies the URL to use when presenting a map of a physical location by st
|
||||
|
||||
Default: `1000`
|
||||
|
||||
A web user or API consumer can request an arbitrary number of objects by appending the "limit" parameter to the URL (e.g. `?limit=1000`). This parameter defines the maximum acceptable limit. Setting this to `0` or `None` will allow a client to retrieve _all_ matching objects at once with no limit by specifying `?limit=0`.
|
||||
Defines the maximum number of objects that may be returned in a single page across the web UI, REST API, and GraphQL API. Setting `MAX_PAGE_SIZE` to `0` or `None` removes the limit.
|
||||
|
||||
See the [REST API](../integrations/rest-api.md#pagination) and [GraphQL API](../integrations/graphql-api.md#pagination) pagination documentation for details.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -75,6 +75,39 @@ The configuration can be rendered as JSON or as plaintext by setting the `Accept
|
||||
* `Accept: application/json`
|
||||
* `Accept: text/plain`
|
||||
|
||||
### Overriding the Config Template
|
||||
|
||||
To render a specific config template against a device's context data - rather than the template resolved via the fallback chain above — include `config_template_id` in the request body:
|
||||
|
||||
```no-highlight
|
||||
curl -X POST \
|
||||
-H "Authorization: Token $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Accept: application/json; indent=4" \
|
||||
http://netbox:8000/api/dcim/devices/123/render-config/ \
|
||||
--data '{
|
||||
"config_template_id": 42
|
||||
}'
|
||||
```
|
||||
|
||||
This is useful for rendering partial or alternative templates against a device's assembled context without changing any stored assignments. Any additional keys in the request body are passed into the template as context variables alongside the device's own config context data, as with standard rendering:
|
||||
|
||||
```no-highlight
|
||||
--data '{
|
||||
"config_template_id": 42,
|
||||
"environment": "staging"
|
||||
}'
|
||||
```
|
||||
|
||||
!!! note "Permissions"
|
||||
Overriding the config template requires the requesting user to have `view` permission for the "Extras > Config Template" object type in addition to the `render_config` permission on the device.
|
||||
|
||||
The same override is available in the UI by appending `config_template_id` as a query parameter to the device's render config URL:
|
||||
|
||||
```no-highlight
|
||||
/dcim/devices/123/render-config/?config_template_id=42
|
||||
```
|
||||
|
||||
### General Purpose Use
|
||||
|
||||
NetBox config templates can also be rendered without being tied to any specific device, using a separate general purpose REST API endpoint. Any data included with a POST request to this endpoint will be passed as context data for the template.
|
||||
|
||||
@@ -141,7 +141,13 @@ To ensure consistent ordering, objects will always be ordered by their primary k
|
||||
|
||||
!!! note "Cursor-based pagination was introduced in NetBox v4.5.2."
|
||||
|
||||
Both pagination strategies support passing an optional `limit` parameter. In both approaches, this specifies the maximum number of objects to include in the response. If no limit is specified, a default value of 100 is used.
|
||||
Both pagination strategies support an optional `limit` parameter specifying the maximum number of objects to include in the response. The [`MAX_PAGE_SIZE`](../configuration/miscellaneous.md#max_page_size) configuration parameter (default `1000`) sets a hard ceiling on this value; if no limit is specified, up to `MAX_PAGE_SIZE` records are returned.
|
||||
|
||||
When `MAX_PAGE_SIZE` is set to `0` or `None`:
|
||||
|
||||
* Omitting the `pagination` argument entirely returns all matching records.
|
||||
* Supplying `pagination` without a `limit` returns up to Strawberry Django's default of 100 records.
|
||||
* Supplying `pagination: {limit: 0}` returns _zero_ records — the opposite of the REST API's `?limit=0` semantics.
|
||||
|
||||
### Offset Pagination
|
||||
|
||||
|
||||
Reference in New Issue
Block a user