-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webhook timestamp format #14299
Comments
I'm unable to understand what the inconsistency is here? |
I have not added everything (sorry) from the output - but everywhere else you are doing iso8601 format - but also know this will break things - as people probably has made a work around "timestamp": "2023-11-21 21:00:12.324363+00:00" and all other places the iso format is used { |
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-
....
The text was updated successfully, but these errors were encountered: