Webhooks should optionally send the previous object or a diff #3602

Closed
opened 2025-12-29 18:30:05 +01:00 by adam · 5 comments
Owner

Originally created by @twexler on GitHub (Apr 23, 2020).

Environment

  • Python version: 3.x.x
  • NetBox version: 2.7.10

Proposed Functionality

Webhook payloads would either contain the previous state of the object, or a diff of what is changing

Use Case

We're using Netbox as a source of truth to drive declarative deployments with ansible, wherein the inventory file is automatically updated by an external system via Git. Knowing both the original and the end state of the object is important in this workflow, as the inventory files may be stored in disparate git repos.

Database Changes

None

External Dependencies

None

Originally created by @twexler on GitHub (Apr 23, 2020). <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for proposing specific new features or enhancements. If you have a general idea or question, please post to our mailing list instead of opening an issue: https://groups.google.com/forum/#!forum/netbox-discuss NOTE: Due to an excessive backlog of feature requests, we are not currently accepting any proposals which significantly extend NetBox's feature scope. Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 3.x.x * NetBox version: 2.7.10 <!-- Describe in detail the new functionality you are proposing. Include any specific changes to work flows, data models, or the user interface. --> ### Proposed Functionality Webhook payloads would either contain the previous state of the object, or a diff of what is changing <!-- Convey an example use case for your proposed feature. Write from the perspective of a NetBox user who would benefit from the proposed functionality and describe how. ---> ### Use Case We're using Netbox as a source of truth to drive declarative deployments with ansible, wherein the inventory file is automatically updated by an external system via Git. Knowing both the original and the end state of the object is important in this workflow, as the inventory files may be stored in disparate git repos. <!-- Note any changes to the database schema necessary to support the new feature. For example, does the proposal require adding a new model or field? (Not all new features require database changes.) ---> ### Database Changes None <!-- List any new dependencies on external libraries or services that this new feature would introduce. For example, does the proposal require the installation of a new Python package? (Not all new features introduce new dependencies.) --> ### External Dependencies None
adam closed this issue 2025-12-29 18:30:05 +01:00
Author
Owner

@dstarner commented on GitHub (Apr 23, 2020):

I wouldn't say optionally. The changelog should provide a diff in case the last change was outside of the retention log period. This functionality already exists and is used elsewhere, so using this to save to the model shouldn't be a big deal, other than some slight gained performance overhead.

@dstarner commented on GitHub (Apr 23, 2020): I wouldn't say optionally. The changelog should provide a diff in case the last change was outside of the retention log period. This functionality already exists and is used elsewhere, so using this to save to the model shouldn't be a big deal, other than some slight gained performance overhead.
Author
Owner

@twexler commented on GitHub (Apr 23, 2020):

I'm only proposing it be optional as it's a potential breaking change in the webhook's payload shape, and it could potentially make the webhook payload much larger.

@twexler commented on GitHub (Apr 23, 2020): I'm only proposing it be optional as it's a potential breaking change in the webhook's payload shape, and it could potentially make the webhook payload much larger.
Author
Owner

@dstarner commented on GitHub (Apr 23, 2020):

I would think that adding a prev_object_data to the ObjectChange model wouldn't be too bad. Then scripts, webhooks, and the API could use this functionality.

@dstarner commented on GitHub (Apr 23, 2020): I would think that adding a `prev_object_data` to the `ObjectChange` model wouldn't be too bad. Then scripts, webhooks, and the API could use this functionality.
Author
Owner

@jeremystretch commented on GitHub (Apr 24, 2020):

Duplicate of #3451

@jeremystretch commented on GitHub (Apr 24, 2020): Duplicate of #3451
Author
Owner

@twexler commented on GitHub (Apr 24, 2020):

@jeremystretch that issue was closed as stale, and the comments don't address the concerns I'm looking to address. Can we re-open this for more discussion?

@twexler commented on GitHub (Apr 24, 2020): @jeremystretch that issue was closed as stale, and the comments don't address the concerns I'm looking to address. Can we re-open this for more discussion?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3602