unable to assign ip to interface (by PATCH method) #10571

Closed
opened 2025-12-29 21:33:15 +01:00 by adam · 2 comments
Owner

Originally created by @yanecisco on GitHub (Dec 12, 2024).

Deployment Type

Self-hosted

Triage priority

N/A

NetBox Version

4.1.7

Python Version

3.11

Steps to Reproduce

  1. Create IP (id 1)
  2. Create Device with Interface (id 1)
  3. (API) curl -H @.env -X PATCH https://netbox/api/ipam/ip-addresses/1/ -d '[{"assigned_object_type":"dcim.interface","assigned_object_id":1}]'

Expected Behavior

Assign IP to device interface. Same task done manually by webUI works as expected.

Observed Behavior

Throws error:
{"error": "Serializers with many=True do not support multiple update by default, only multiple create. For updates it is unclear how to deal with insertions and deletions. If you need to support multiple update, use a ListSerializer class and override .update() so you can specify the behavior exactly.", "exception": "NotImplementedError", "netbox_version": "4.1.7", "python_version": "3.11.2"}

Originally created by @yanecisco on GitHub (Dec 12, 2024). ### Deployment Type Self-hosted ### Triage priority N/A ### NetBox Version 4.1.7 ### Python Version 3.11 ### Steps to Reproduce 1. Create IP (id 1) 2. Create Device with Interface (id 1) 3. (API) curl -H @.env -X PATCH https://netbox/api/ipam/ip-addresses/1/ -d '[{"assigned_object_type":"dcim.interface","assigned_object_id":1}]' ### Expected Behavior Assign IP to device interface. Same task done manually by webUI works as expected. ### Observed Behavior Throws error: {"error": "Serializers with many=True do not support multiple update by default, only multiple create. For updates it is unclear how to deal with insertions and deletions. If you need to support multiple update, use a `ListSerializer` class and override `.update()` so you can specify the behavior exactly.", "exception": "NotImplementedError", "netbox_version": "4.1.7", "python_version": "3.11.2"}
adam closed this issue 2025-12-29 21:33:17 +01:00
Author
Owner

@jeremystretch commented on GitHub (Dec 12, 2024):

The error seems to arise from encapsulating the object data within a list in your request. When modifying a single object, just pass the bare dictionary:

--data '{"assigned_object_type": "dcim.interface", "assigned_object_id": 1}'

This should work as expected.

@jeremystretch commented on GitHub (Dec 12, 2024): The error seems to arise from encapsulating the object data within a list in your request. When modifying a single object, just pass the bare dictionary: ``` --data '{"assigned_object_type": "dcim.interface", "assigned_object_id": 1}' ``` This should work as expected.
Author
Owner

@yanecisco commented on GitHub (Dec 12, 2024):

Oh, of course! Not a bug, just problem between the chair and the keyboard.

Yes, that change works. I've expected some other error message in this case. Anyway, thank you!

@yanecisco commented on GitHub (Dec 12, 2024): Oh, of course! Not a bug, just problem between the chair and the keyboard. Yes, that change works. I've expected some other error message in this case. Anyway, thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10571