API erroneously requiring manufacturer when submitting inventory through /api/dcim/inventory-items/ #1926

Closed
opened 2025-12-29 17:20:37 +01:00 by adam · 1 comment
Owner

Originally created by @frankfarmer on GitHub (Aug 9, 2018).

Environment

  • Python version: 2.7.15rc1
  • NetBox version: 2.4.2

Steps to Reproduce

POST a json body without manufacturer to /api/dcim/inventory-items/, e.g.:

$ curl -d '{"device": 2171, "name": "RAID Controller", "description": "LSI Logic MegaRAID"}' netbox-s2/api/dcim/inventory-items/ -H 'authorization: Token 00deadbeef00' -H 'Content-Type: application/json; version=2.4;' -sv

This seems similar to the issue reported in #2305

Expected Behavior

The item should be created successfully with a null manufacturer

Sending the same payload to netbox 2.3 works fine -- a 201 created response comes back

Creating an inventory item through the UI at /dcim/devices//inventory/
accepts items without manufacturer just fine (and when queried via the API, they appear with a null manufacturer)

Observed Behavior

 HTTP/1.1 400 Bad Request
{"manufacturer":["This field is required."]}
Originally created by @frankfarmer on GitHub (Aug 9, 2018). <!-- NOTE: This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 2.7.15rc1 * NetBox version: 2.4.2 <!-- Describe in detail the steps that someone else can take to reproduce this bug using the current stable release of NetBox (or the current beta release where applicable). --> ### Steps to Reproduce POST a json body without manufacturer to /api/dcim/inventory-items/, e.g.: ``` $ curl -d '{"device": 2171, "name": "RAID Controller", "description": "LSI Logic MegaRAID"}' netbox-s2/api/dcim/inventory-items/ -H 'authorization: Token 00deadbeef00' -H 'Content-Type: application/json; version=2.4;' -sv ``` This seems similar to the issue reported in #2305 <!-- What did you expect to happen? --> ### Expected Behavior The item should be created successfully with a null manufacturer Sending the same payload to netbox 2.3 works fine -- a 201 created response comes back Creating an inventory item through the UI at /dcim/devices/<ID>/inventory/ accepts items without manufacturer just fine (and when queried via the API, they appear with a null manufacturer) <!-- What happened instead? --> ### Observed Behavior ``` HTTP/1.1 400 Bad Request {"manufacturer":["This field is required."]} ```
adam added the type: bugstatus: accepted labels 2025-12-29 17:20:37 +01:00
adam closed this issue 2025-12-29 17:20:37 +01:00
Author
Owner

@jeremystretch commented on GitHub (Aug 9, 2018):

Similar issue to #2335, where UniqueTogetherValidator is forcing manufacturer as a required field. Adding default=None to the field relaxes this requirement. This will be fixed in v2.4.3.

@jeremystretch commented on GitHub (Aug 9, 2018): Similar issue to #2335, where UniqueTogetherValidator is forcing `manufacturer` as a required field. Adding `default=None` to the field relaxes this requirement. This will be fixed in v2.4.3.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1926