Multiselect field producing error when attempting to populate via REST API #7023

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

Originally created by @adfrost81 on GitHub (Sep 24, 2022).

NetBox version

v3.2.3

Python version

3.8

Steps to Reproduce

  1. Created multiselect custom field "str_small_printers" with the following options: HP LaserJet M402dn,HP LaserJet M404dn

  2. Sent the following JSON script via Postman:

[ { "id": 809, "custom_fields": { "str_small_printers": "HP LaserJet M402dn" } } ]

2022-09-23 17_10_50-Postman

Expected Behavior

The custom field should have been populated with the value provided.

Formatting and spelling were verified to match multiselect choices. Verified JSON syntax is correct.

Observed Behavior

Field is not populated. Received the following error response:

{ "__all__": [ "Invalid value for custom field 'str_small_printers': Invalid choice(s) (H, P, , L, a, s, e, r, J, e, t, , M, 4, 0, 2, d, n). Available choices are: HP LaserJet M402dn, HP LaserJet M404dn" ] }

Originally created by @adfrost81 on GitHub (Sep 24, 2022). ### NetBox version v3.2.3 ### Python version 3.8 ### Steps to Reproduce 1. Created multiselect custom field "str_small_printers" with the following options: HP LaserJet M402dn,HP LaserJet M404dn 2. Sent the following JSON script via Postman: `[ { "id": 809, "custom_fields": { "str_small_printers": "HP LaserJet M402dn" } } ]` ![2022-09-23 17_10_50-Postman](https://user-images.githubusercontent.com/91818709/192063648-11afd8cc-7b71-4d72-8545-86714b3c60f6.png) ### Expected Behavior The custom field should have been populated with the value provided. Formatting and spelling were verified to match multiselect choices. Verified JSON syntax is correct. ### Observed Behavior Field is not populated. Received the following error response: `{ "__all__": [ "Invalid value for custom field 'str_small_printers': Invalid choice(s) (H, P, , L, a, s, e, r, J, e, t, , M, 4, 0, 2, d, n). Available choices are: HP LaserJet M402dn, HP LaserJet M404dn" ] }`
adam closed this issue 2025-12-29 19:48:00 +01:00
Author
Owner

@jeremystretch commented on GitHub (Sep 26, 2022):

The value of a multi-object field must be sent as a list, not a string.

@jeremystretch commented on GitHub (Sep 26, 2022): The value of a multi-object field must be sent as a list, not a string.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7023