REST API: PATCH / PUT results in error code 400, Expected a list of items but got type "dict" #4647

Closed
opened 2025-12-29 19:19:06 +01:00 by adam · 1 comment
Owner

Originally created by @ghost on GitHub (Mar 11, 2021).

NetBox version

v2.10.3

Python version

3.6

Steps to Reproduce

  1. Go to netbox API swagger
  2. Try to update the description field for an IP /ipam/ip-addresses/ using either PUT or PATCH method
  3. Specify only the field values for address and description

Expected Behavior

Response code 200 with the information for the provided IP address

Observed Behavior

Response code 400, with the response body

{
"non_field_errors": [
"Expected a list of items but got type "dict"."
]
}

The same issue appears when trying to update data field values for a device at /dcim/devices/

The same issue was described on https://www.gitmemory.com/issue/netbox-community/netbox/5582/755357450

Originally created by @ghost on GitHub (Mar 11, 2021). ### NetBox version v2.10.3 ### Python version 3.6 ### Steps to Reproduce 1. Go to netbox API swagger 2. Try to update the description field for an IP /ipam/ip-addresses/ using either PUT or PATCH method 3. Specify only the field values for address and description ### Expected Behavior Response code 200 with the information for the provided IP address ### Observed Behavior Response code 400, with the response body { "non_field_errors": [ "Expected a list of items but got type \"dict\"." ] } The same issue appears when trying to update data field values for a device at /dcim/devices/ The same issue was described on https://www.gitmemory.com/issue/netbox-community/netbox/5582/755357450
adam added the type: bug label 2025-12-29 19:19:06 +01:00
adam closed this issue 2025-12-29 19:19:07 +01:00
Author
Owner

@DanSheps commented on GitHub (Mar 11, 2021):

As per the linked issues: #5582, you are using the list endpoint. You need to use the single item endpoint (/dcim/devices/<id> or /ipam/ip-addresses/<id>)

@DanSheps commented on GitHub (Mar 11, 2021): As per the linked issues: #5582, you are using the list endpoint. You need to use the single item endpoint (/dcim/devices/\<id> or /ipam/ip-addresses/\<id>)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4647