Invalid REST API request setting custom fields raises TypeError #6869

Closed
opened 2025-12-29 19:46:14 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Aug 24, 2022).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.3.0

Python version

3.8

Steps to Reproduce

Send a malformed REST API request attempting to set custom fields for an object. For example:

curl -X PATCH \
-H "Authorization: Token $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json; indent=4" \
http://netbox:8000/api/dcim/sites/1/ \
--data '{"custom_fields": "xxx"}'

Note that custom_fields maps to a string rather than a dictionary.

Expected Behavior

NetBox should return a 400 Bad Request response indicating the reason for the failure.

Observed Behavior

A TypeError exception is raised.

Originally created by @jeremystretch on GitHub (Aug 24, 2022). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.3.0 ### Python version 3.8 ### Steps to Reproduce Send a malformed REST API request attempting to set custom fields for an object. For example: ``` curl -X PATCH \ -H "Authorization: Token $TOKEN" \ -H "Content-Type: application/json" \ -H "Accept: application/json; indent=4" \ http://netbox:8000/api/dcim/sites/1/ \ --data '{"custom_fields": "xxx"}' ``` Note that `custom_fields` maps to a string rather than a dictionary. ### Expected Behavior NetBox should return a 400 Bad Request response indicating the reason for the failure. ### Observed Behavior A TypeError exception is raised.
adam added the type: bugstatus: accepted labels 2025-12-29 19:46:14 +01:00
adam closed this issue 2025-12-29 19:46:14 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6869