mirror of
https://github.com/netbox-community/netbox.git
synced 2026-03-31 06:33:20 +02:00
* Add message field to ObjectChange model * Set max length on changelog message * Enable changelog messages for single object operations * Fix tests * Add changelog message support for bulk edit & bulk delete * Cosmetic improvements to form fields * Fix bulk operation templates * Add message support for bulk import/update * Add REST API support for changelog messages (WIP) * Fix changelog_message assignment * Enable changelog message support for bulk deletions * Add documentation * Fix changelog message support for VirtualChassis * Add ChangeLoggingMixin to necesssary model forms * Introduce get_random_string() utility function for tests * Incorporate changelog messages for object view tests * Incorporate changelog messages for object bulk view tests * Add missing mixins for changelog message support * Tweak test to generate expected number of change records * Finish adding tests for changelog message functionality * Misc cleanup * Fixes #19956: Prevent duplicate deletion records from cascading deletions * Tweak bulk deletion test to work around cascading deletions issue * Correct API URL
This commit is contained in:
@@ -8,6 +8,12 @@ When a request is made, a UUID is generated and attached to any change records r
|
||||
|
||||
Change records are exposed in the API via the read-only endpoint `/api/extras/object-changes/`. They may also be exported via the web UI in CSV format.
|
||||
|
||||
## User Messages
|
||||
|
||||
!!! info "This feature was introduced in NetBox v4.4."
|
||||
|
||||
When creating, modifying, or deleting an object in NetBox, a user has the option of recording an arbitrary message that will appear in the change record. This can be helpful to capture additional context, such as the reason for the change.
|
||||
|
||||
## Correlating Changes by Request
|
||||
|
||||
Every request made to NetBox is assigned a random unique ID that can be used to correlate change records. For example, if you change the status of three sites using the UI's bulk edit feature, you will see three new change records (one for each site) all referencing the same request ID. This shows that all three changes were made as part of the same request.
|
||||
|
||||
@@ -608,6 +608,28 @@ http://netbox/api/dcim/sites/ \
|
||||
!!! note
|
||||
The bulk deletion of objects is an all-or-none operation, meaning that if NetBox fails to delete any of the specified objects (e.g. due a dependency by a related object), the entire operation will be aborted and none of the objects will be deleted.
|
||||
|
||||
## Changelog Messages
|
||||
|
||||
!!! info "This feature was introduced in NetBox v4.4."
|
||||
|
||||
Most objects in NetBox support [change logging](../features/change-logging.md), which generates a detailed record each time an object is created, modified, or deleted. Beginning in NetBox v4.4, users can attach a message to the change record as well. This is accomplished via the REST API by including a `changelog_message` field in the object representation.
|
||||
|
||||
For example, the following API request will create a new site and record a message in the resulting changelog entry:
|
||||
|
||||
```no-highlight
|
||||
curl -s -X POST \
|
||||
-H "Authorization: Token $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
http://netbox/api/dcim/sites/ \
|
||||
--data '{
|
||||
"name": "Site A",
|
||||
"slug": "site-a",
|
||||
"changelog_message": "Adding a site for ticket #4137"
|
||||
}'
|
||||
```
|
||||
|
||||
This approach works when creating, modifying, or deleting objects, either individually or in bulk.
|
||||
|
||||
## Uploading Files
|
||||
|
||||
As JSON does not support the inclusion of binary data, files cannot be uploaded using JSON-formatted API requests. Instead, we can use form data encoding to attach a local file.
|
||||
|
||||
Reference in New Issue
Block a user