Change of rack location via API does not work #10529

Closed
opened 2025-12-29 21:32:39 +01:00 by adam · 2 comments
Owner

Originally created by @TorstenEhrhardt on GitHub (Dec 2, 2024).

Deployment Type

Self-hosted

Triage priority

N/A

NetBox Version

v4.1.7

Python Version

3.11

Steps to Reproduce

  • Create Rack in a site and location
  • facility id is not set (null)
  • send patch request to /api/dcim/racks/:id/ with payload
{
    "location": {
        "name": "Other location",
        "site": {
            "name": "Other site"
        }
    },
    "site": {
        "name": "Other site"
    }
}

or only change location with a global unique location

{
    "location": {
        "name": "Other location"
    }
}

Example performed on https://demo.netbox.dev

grafik

Expected Behavior

Location and site of rack is changed, like it does in the frontend

Observed Behavior

Receiving

{
"non_field_errors": [
"The fields location, facility_id must make a unique set."
]
}

If you set some facility_id in the request it's working, also set the facility_id to null after the location was changed

Originally created by @TorstenEhrhardt on GitHub (Dec 2, 2024). ### Deployment Type Self-hosted ### Triage priority N/A ### NetBox Version v4.1.7 ### Python Version 3.11 ### Steps to Reproduce - Create Rack in a site and location - facility id is not set (null) - send patch request to /api/dcim/racks/:id/ with payload ``` { "location": { "name": "Other location", "site": { "name": "Other site" } }, "site": { "name": "Other site" } } ``` or only change location with a global unique location ``` { "location": { "name": "Other location" } } ``` Example performed on https://demo.netbox.dev ![grafik](https://github.com/user-attachments/assets/1d0fd50d-61fc-429e-b1fe-7d9ae14276ce) ### Expected Behavior Location and site of rack is changed, like it does in the frontend ### Observed Behavior Receiving > { "non_field_errors": [ "The fields location, facility_id must make a unique set." ] } If you set some facility_id in the request it's working, also set the facility_id to null after the location was changed
adam added the type: bugstatus: duplicate labels 2025-12-29 21:32:39 +01:00
adam closed this issue 2025-12-29 21:32:39 +01:00
Author
Owner

@jeremystretch commented on GitHub (Dec 2, 2024):

This appears to be related to #17810, in which a bug in DRF fails to recognize that one of the fields required by a uniqueness constraints is null.

@jeremystretch commented on GitHub (Dec 2, 2024): This appears to be related to #17810, in which a [bug in DRF](https://github.com/encode/django-rest-framework/issues/9410) fails to recognize that one of the fields required by a uniqueness constraints is null.
Author
Owner

@jeremystretch commented on GitHub (Dec 5, 2024):

Confirmed that the fix for #17810 has also resolved this issue, so I'm going to reclassify it as a duplicate.

@jeremystretch commented on GitHub (Dec 5, 2024): Confirmed that the fix for #17810 has also resolved this issue, so I'm going to reclassify it as a duplicate.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10529