Skip to content

webhook timestamp format #14299

@mmolbech

Description

@mmolbech

NetBox version

v3.6.5

Python version

3.11

Steps to Reproduce

This is my first bug report :) for netbox so bear with me

I was generating a webhook feature on virtual machines - and i discovery/got annoyed on the inconstancy with the timestamp, for each event.

{"event": "updated", "timestamp": "2023-11-17 22:03:54.864187+00:00", "model": "virtualmachine", "username": "*******", "request_id": "f27dc260-7190-4494-b1a3-34754e86fe1a", "data": {"id": 60, "url": "/api/virtualization/virtual-
....

So i was looking at the code to find the place where it does the timestamping and found it in netbox/netbox/webhooks.py, and
i change line 119 in webhooks.py

from timestamp=str(timezone.now()),
to timestamp=str(timezone.now().isoformat()),

and get iso8601 format

{"event": "deleted", "timestamp": "2023-11-18T20:16:40.955375+00:00", "model": "virtualmachine", "username": "*****", "request_id": "e4fbac3e-810b-4aff-aae6-cf35c68d49a4", "data": {"id": 51, "url": "/api/virtualization/virtual-machines/51/",
.....

The other timestamps in the event is in iso8601 format

Regards
Michael

Expected Behavior

I would expect a ISO8601 format

{"event": "deleted", "timestamp": "2023-11-18T20:16:40.955375+00:00", "model": "virtualmachine", "username": "*****", "request_id": "e4fbac3e-810b-4aff-aae6-cf35c68d49a4", "data": {"id": 51, "url": "/api/virtualization/virtual-machines/51/",
.....

Observed Behavior

I saw this

{"event": "updated", "timestamp": "2023-11-17 22:03:54.864187+00:00", "model": "virtualmachine", "username": "*******", "request_id": "f27dc260-7190-4494-b1a3-34754e86fe1a", "data": {"id": 60, "url": "/api/virtualization/virtual-
....

Metadata

Metadata

Assignees

Labels

severity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: 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