Can't create new sitegroup with parent using REST api #4814

Closed
opened 2025-12-29 19:20:53 +01:00 by adam · 0 comments
Owner

Originally created by @PeterO2 on GitHub (Apr 23, 2021).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v2.11.0

Python version

3.6

Steps to Reproduce

Post a new sitegroup to api/dcim/site-groups/ with data {"name":"name","slug":"slug","parent":< id >} where parent is id of an existing sitegroup.

Expected Behavior

A new sitegroup should have been created with parent showing the sitegroup where parent refers to.

Observed Behavior

A 500 Internal Error is returned.
{
"error": "Cannot assign "<Region: Region1>": "SiteGroup.parent" must be a "SiteGroup" instance.",
"exception": "ValueError",
"netbox_version": "2.11.0",
"python_version": "3.6.9"
}

Bug is already detected in the code here: https://github.com/netbox-community/netbox/blob/master/netbox/dcim/api/serializers.py#L93
But it's not sure if it's the only cause.

Originally created by @PeterO2 on GitHub (Apr 23, 2021). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v2.11.0 ### Python version 3.6 ### Steps to Reproduce Post a new sitegroup to api/dcim/site-groups/ with data {"name":"name","slug":"slug","parent":< id >} where parent is id of an existing sitegroup. ### Expected Behavior A new sitegroup should have been created with parent showing the sitegroup where parent refers to. ### Observed Behavior A 500 Internal Error is returned. { "error": "Cannot assign "<Region: Region1>": "SiteGroup.parent" must be a "SiteGroup" instance.", "exception": "ValueError", "netbox_version": "2.11.0", "python_version": "3.6.9" } Bug is already detected in the code here: https://github.com/netbox-community/netbox/blob/master/netbox/dcim/api/serializers.py#L93 But it's not sure if it's the only cause.
adam added the type: bugstatus: accepted labels 2025-12-29 19:20:53 +01:00
adam closed this issue 2025-12-29 19:20:53 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4814