New device not create via API, insists to provide device when it is given. #9091

Closed
opened 2025-12-29 20:45:20 +01:00 by adam · 4 comments
Owner

Originally created by @leijonatm on GitHub (Jan 16, 2024).

Deployment Type

Self-hosted

NetBox Version

v.3.7.0

Python Version

3.10

Steps to Reproduce

  1. I try to create a new device.
  2. I downgraded to version 3.6.6 and still happend.
  3. I then tried 3.4.8 and the device gets created.

Expected Behavior

New device should be created with the provided parameters

Observed Behavior

Error: [POST /dcim/devices/][400] dcim_devices_create default map[role:[This field is required.]]

Originally created by @leijonatm on GitHub (Jan 16, 2024). ### Deployment Type Self-hosted ### NetBox Version v.3.7.0 ### Python Version 3.10 ### Steps to Reproduce 1. I try to create a new device. 2. I downgraded to version 3.6.6 and still happend. 3. I then tried 3.4.8 and the device gets created. ### Expected Behavior New device should be created with the provided parameters ### Observed Behavior Error: [POST /dcim/devices/][400] dcim_devices_create default map[role:[This field is required.]]
adam closed this issue 2025-12-29 20:45:20 +01:00
Author
Owner

@fikusir commented on GitHub (Jan 16, 2024):

Can you provide us the provided parameters? Thanks

@fikusir commented on GitHub (Jan 16, 2024): Can you provide us the provided parameters? Thanks
Author
Owner

@leijonatm commented on GitHub (Jan 16, 2024):

Hello @fikusir ,
I provide them via terraform

resource "netbox_device" "test" {
  name           = "HP1"
  device_type_id = 1
  role_id        = 1
  site_id        = 1
}

Role with ID 1 exists. To test it further I put a non existent ID for device_type and I get a "not found" for that ID.See the error below, I get nothing for role_id. It is like I haven't provided it. One other thing to notice is that device_type is referred as it should be but the device_role is referred plainly as role. Could this be an issue ?

Error: [POST /dcim/devices/][400] dcim_devices_create default map[device_type:[Related object not found using the provided numeric ID: 223] role:[This field is required.]]

@leijonatm commented on GitHub (Jan 16, 2024): Hello @fikusir , I provide them via terraform ``` resource "netbox_device" "test" { name = "HP1" device_type_id = 1 role_id = 1 site_id = 1 } ``` Role with ID 1 exists. To test it further I put a non existent ID for device_type and I get a "not found" for that ID.See the error below, I get nothing for role_id. It is like I haven't provided it. One other thing to notice is that device_type is referred as it should be but the device_role is referred plainly as role. Could this be an issue ? `Error: [POST /dcim/devices/][400] dcim_devices_create default map[device_type:[Related object not found using the provided numeric ID: 223] role:[This field is required.]]`
Author
Owner

@abhi1693 commented on GitHub (Jan 16, 2024):

Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v3.7.0. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data.

Apart from the canned message, you should provide the steps using CURL commands for us to be able to help us. Any other libraries are out of scope and any bugs should be raised on the respective repo.

@abhi1693 commented on GitHub (Jan 16, 2024): Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v3.7.0. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data. Apart from the canned message, you should provide the steps using CURL commands for us to be able to help us. Any other libraries are out of scope and any bugs should be raised on the respective repo.
Author
Owner

@leijonatm commented on GitHub (Jan 16, 2024):

Hello @abhi1693,
thanks for replying.

  1. I had a clean install of netbox on docker.
  2. Created a user
  3. Added a token for the user
  4. Run the terraform deployment.
    I followed these steps for both 3.7.0 and all from the v3.6 range but all of the fail. I am able to create the device in version 3.5.9 and before. I then see there are breaking changes regarding v3.6.0 about the device_role. I will take it with the TF provider. Thanks !
@leijonatm commented on GitHub (Jan 16, 2024): Hello @abhi1693, thanks for replying. 1. I had a clean install of netbox on docker. 2. Created a user 3. Added a token for the user 4. Run the terraform deployment. I followed these steps for both 3.7.0 and all from the v3.6 range but all of the fail. I am able to create the device in version 3.5.9 and before. I then see there are breaking changes regarding v3.6.0 about the device_role. I will take it with the TF provider. Thanks !
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9091