'Object is not iterable' when setting a custom field (object) on Object Type through API #9706

Closed
opened 2025-12-29 21:21:23 +01:00 by adam · 0 comments
Owner

Originally created by @Leon-Pay on GitHub (May 21, 2024).

Originally assigned to: @jeremystretch on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.0.2

Python Version

3.11

Steps to Reproduce

Create a virtual machine

Create a custom field for "Virtualization > Virtual Machine" with type Object (Journal Entry)

Create a Journal Entry, ex. on the demo vm1 (361)

Set the custom field to the Journal Entry with the API, it works with the GUI

ex.

curl -X 'PUT' \
  'https://demo.netbox.dev/api/virtualization/virtual-machines/361/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'X-CSRFTOKEN: xxxx' \
  -d '{"custom_fields": {"api_test_custom_field_object": "1"}}'

Expected Behavior

Get repsonse 200, set the journal entry to the custom field

Observed Behavior

Cant add the entry through the api

{
  "error": "argument of type 'JournalEntry' is not iterable",
  "exception": "TypeError",
  "netbox_version": "4.0.2",
  "python_version": "3.10.14"
}
Originally created by @Leon-Pay on GitHub (May 21, 2024). Originally assigned to: @jeremystretch on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.0.2 ### Python Version 3.11 ### Steps to Reproduce Create a virtual machine Create a custom field for "Virtualization > Virtual Machine" with type Object (Journal Entry) Create a Journal Entry, ex. on the demo vm1 (361) Set the custom field to the Journal Entry with the API, it works with the GUI ex. ``` curl -X 'PUT' \ 'https://demo.netbox.dev/api/virtualization/virtual-machines/361/' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -H 'X-CSRFTOKEN: xxxx' \ -d '{"custom_fields": {"api_test_custom_field_object": "1"}}' ``` ### Expected Behavior Get repsonse 200, set the journal entry to the custom field ### Observed Behavior Cant add the entry through the api ``` { "error": "argument of type 'JournalEntry' is not iterable", "exception": "TypeError", "netbox_version": "4.0.2", "python_version": "3.10.14" } ```
adam added the type: bugstatus: acceptedseverity: medium labels 2025-12-29 21:21:23 +01:00
adam closed this issue 2025-12-29 21:21:23 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9706