Create interface via API requires optional fields to be filled #1896

Closed
opened 2025-12-29 17:20:11 +01:00 by adam · 3 comments
Owner

Originally created by @sdktr on GitHub (Aug 6, 2018).

Environment

  • Python version: 3.6
  • NetBox version: 2.4-develop

Steps to Reproduce

POST a new interface via the API, using the same fields as one would in the GUI

curl -X POST \
  http://netbox/api/virtualization/interfaces/ \
  -H 'Accept: application/json' \
  -H 'Authorization: Token 12345' \
  -H 'Content-Type: application/json' \
  -d '{
    "addresses":  [
                      "172.27.127.7/32"
                  ],
    "mac_address":  "00:50:56:8b:22:41",
    "name":  "Network adapter 1",
    "virtual_machine":  1,
    "enabled":  true
}'

Expected Behavior

New interface should be added

Observed Behavior

Netbox requests additional fields to be filled in:

{
    "mode": [
        "This field is required."
    ],
    "untagged_vlan": [
        "This field is required."
    ],
    "tagged_vlans": [
        "This field is required."
    ]
}
Originally created by @sdktr on GitHub (Aug 6, 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: 3.6<!-- Example: 3.5.4 --> * NetBox version: 2.4-develop<!-- Example: 2.3.6 --> <!-- 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 new interface via the API, using the same fields as one would in the GUI ``` curl -X POST \ http://netbox/api/virtualization/interfaces/ \ -H 'Accept: application/json' \ -H 'Authorization: Token 12345' \ -H 'Content-Type: application/json' \ -d '{ "addresses": [ "172.27.127.7/32" ], "mac_address": "00:50:56:8b:22:41", "name": "Network adapter 1", "virtual_machine": 1, "enabled": true }' ``` <!-- What did you expect to happen? --> ### Expected Behavior New interface should be added <!-- What happened instead? --> ### Observed Behavior Netbox requests additional fields to be filled in: ``` { "mode": [ "This field is required." ], "untagged_vlan": [ "This field is required." ], "tagged_vlans": [ "This field is required." ] }
adam added the type: bugstatus: accepted labels 2025-12-29 17:20:11 +01:00
adam closed this issue 2025-12-29 17:20:11 +01:00
Author
Owner

@sdktr commented on GitHub (Aug 6, 2018):

The problem does not occur in v2.3.2. I assume the below patch is the cause for the new fields to become required:
b44aa9d32e (diff-b5b392d3a54921cfdcd9fbe29cab12b4)

@sdktr commented on GitHub (Aug 6, 2018): The problem does not occur in v2.3.2. I assume the below patch is the cause for the new fields to become required: https://github.com/digitalocean/netbox/commit/b44aa9d32ea654de242215238d8c9131f4594d2d#diff-b5b392d3a54921cfdcd9fbe29cab12b4
Author
Owner

@sdktr commented on GitHub (Aug 6, 2018):

Checked with 2.3.7: the issue does NOT present itself in that version, so seems to affect 2.4-develop only

@sdktr commented on GitHub (Aug 6, 2018): Checked with 2.3.7: the issue does NOT present itself in that version, so seems to affect 2.4-develop only
Author
Owner

@sdktr commented on GitHub (Aug 6, 2018):

Awesome work @jeremystretch ! This fixes the vsphere_to_netbox sync script from @jwegner89 for Netbox 2.4 https://github.com/jwegner89/netbox-utilities/blob/master/Sync-Netbox.ps1

@sdktr commented on GitHub (Aug 6, 2018): Awesome work @jeremystretch ! This fixes the vsphere_to_netbox sync script from @jwegner89 for Netbox 2.4 https://github.com/jwegner89/netbox-utilities/blob/master/Sync-Netbox.ps1
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1896