Circuit Provider Account field required API not in GUI #7960

Closed
opened 2025-12-29 20:30:31 +01:00 by adam · 2 comments
Owner

Originally created by @arjenvri on GitHub (Apr 29, 2023).

Originally assigned to: @kkthxbye-code on GitHub.

NetBox version

v3.5.0

Python version

3.8

Steps to Reproduce

  1. Use the REST API to create a new circuit
    { "cid": "12345", "provider": 1, "type": 1, }
    Error: {"provider_account":["This field is required."]}
  2. Use the GUI to add circuit, provider_account is an optional field
  3. Try to add circuit with provider_account set as 0
    { "cid": "12345", "provider": 1, "type": 1, "provider_account": 0 }
    Error: {"provider_account":["Related object not found using the provided numeric ID: 0"]}
  4. Read existing migrated circuit from netbox
    ...."provider_account":null ...

Expected Behavior

The circuit provider_account field should be optional in the RESTAPI as it current is in the GUI.

Observed Behavior

Error was shown requiring the provider_account field to be defined

Originally created by @arjenvri on GitHub (Apr 29, 2023). Originally assigned to: @kkthxbye-code on GitHub. ### NetBox version v3.5.0 ### Python version 3.8 ### Steps to Reproduce 1. Use the REST API to create a new circuit ` { "cid": "12345", "provider": 1, "type": 1, } ` Error: {"provider_account":["This field is required."]} 2. Use the GUI to add circuit, `provider_account` is an optional field 3. Try to add circuit with provider_account set as 0 ` { "cid": "12345", "provider": 1, "type": 1, "provider_account": 0 } ` Error: {"provider_account":["Related object not found using the provided numeric ID: 0"]} 4. Read existing migrated circuit from netbox ` ...."provider_account":null ... ` ### Expected Behavior The circuit `provider_account` field should be optional in the RESTAPI as it current is in the GUI. ### Observed Behavior Error was shown requiring the provider_account field to be defined
adam added the type: bugstatus: accepted labels 2025-12-29 20:30:31 +01:00
adam closed this issue 2025-12-29 20:30:31 +01:00
Author
Owner

@zeddD1abl0 commented on GitHub (Apr 30, 2023):

If you leave the provider_account out of the request entirely does it break? Because if it's not there, it should be null. But if you provide a value, that value needs to exist.

I.E. :
{ "cid": "12345", "provider": 1, "type": 1 }

@zeddD1abl0 commented on GitHub (Apr 30, 2023): If you leave the provider_account out of the request entirely does it break? Because if it's not there, it should be null. But if you provide a value, that value needs to exist. I.E. : `{ "cid": "12345", "provider": 1, "type": 1 }`
Author
Owner

@arjenvri commented on GitHub (Apr 30, 2023):

Without provider_account it breaks indeed. See above step 1

@arjenvri commented on GitHub (Apr 30, 2023): Without provider_account it breaks indeed. See above step 1
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7960