Closed Julio-Oliveira-Encora closed 8 months ago
In the NetBox diode plugin, we need to create an API endpoint for change sets to process by the plugin.
`POST /api/plugins/netbox_diode_plugin/apply-change-set`
Diode's reconciler service will make change sets based on ingested data and existing matching NetBox object states and send a request to this API endpoint.
Payload will contain a list of changes to action with following fields:
* `change_id` - \[required\] string containing change ID generated by diode backend during data ingestion
* `change_type` - \[required\] string containing operation type: `create`, `update`
* `object_type` - \[required\] string containing NetBox object type, i.e. `device`
* `object_id` - integer containing NetBox object ID for change types other than `create` (i.e. we need object ID to update or delete \[in the future\] existing objects)
* `object_version` - integer containing NetBox object's `objectchange` ID (see [https://docs.netbox.dev/en/stable/features/change-logging/](https://docs.netbox.dev/en/stable/features/change-logging/)), similarly to `object_id` required for change types other than `create`
* `data` - \[required\] an object/dict containing properties corresponding to `object_type` NetBox model
Example payload:
```
{
"change_set_id": "
Add an endpoint to apply changes (create and update) objects in the Netbox.