Skip to content

API blocks creation of child region with same name as top-level region, but UI allows it #19302

@mjoshionemind

Description

@mjoshionemind

Deployment Type

Self-hosted

NetBox Version

v4.2.3

Python Version

3.10

Steps to Reproduce

  1. Go to the NetBox UI and navigate to the Regions section.
    Create a new region:Name: Hong Kong, Slug: HK

Image

  1. After creation, create a child region from the UI with the following details:
    Name: Hong Kong,Slug: HK (or any valid unique slug),Parent: Hong Kong (the region created in step 1)

Image

  1. Observe that this is allowed and saved successfully.
  2. Now, attempt the same operation using the API:
    Make a POST request to /api/dcim/regions/ with this payload:
    {
    "name": "Hong Kong",
    "slug": "hk-kong",
    "parent": <id_of_Hong_Kong_region_created_in _step_1>
    }
    Image

Expected Behavior

The child region with the same name (Hong Kong) but a different slug should be created successfully under the parent Hong Kong, matching the behavior observed in the UI.

Observed Behavior

The API returns a 400 Bad Request with an error indicating that the name must be unique or conflicts with the parent, even though the UI allows it.

Metadata

Metadata

Assignees

Labels

severity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions