Please reconsider dropping slugs in URLs in NetBox 2.11 #4724

Closed
opened 2025-12-29 19:19:54 +01:00 by adam · 3 comments
Owner

Originally created by @bootc on GitHub (Apr 6, 2021).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v2.11-beta1

Python version

3.8

Steps to Reproduce

From your release notes:

  • All objects now use numeric IDs in their UI view URLs instead of slugs. You may need to update external references to NetBox objects. (Note that this does not affect the REST API.)
  • The UI now uses numeric IDs when filtering object lists. You may need to update external links to filtered object lists. (Note that the slug- and name-based filters will continue to work, however the filter selection fields within the UI will not be automatically populated.)

Expected Behavior

The use of slugs should remain, ideally indefinitely but at the very least there should be an overlap of at least one release where both work.

Observed Behavior

URL slugs no longer work at all.

We have quite a lot of documentation in other places (e.g. wikis and other documents) which point back at NetBox, and all of those links will break when we upgrade. It's a big ask for us to upgrade and then trawl through all our docs to update the links for (from a user perspective) no discernible gain.

I understand you wanting to change this, and the reasons given. Perhaps the think to do is have some kind of compatibility shim that, if a URL with slugs is detected, can redirect to the URL with IDs instead? That would keep the URLs working, possibly even indefinitely. I think we'd be happy to sacrifice some performance in terms of the extra redirect just to avoid having to spend hours updating all the documentation.

Originally created by @bootc on GitHub (Apr 6, 2021). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v2.11-beta1 ### Python version 3.8 ### Steps to Reproduce From your release notes: * All objects now use numeric IDs in their UI view URLs instead of slugs. You may need to update external references to NetBox objects. (Note that this does not affect the REST API.) * The UI now uses numeric IDs when filtering object lists. You may need to update external links to filtered object lists. (Note that the slug- and name-based filters will continue to work, however the filter selection fields within the UI will not be automatically populated.) ### Expected Behavior The use of slugs should remain, ideally indefinitely but at the very least there should be an overlap of at least one release where both work. ### Observed Behavior URL slugs no longer work at all. We have quite a lot of documentation in other places (e.g. wikis and other documents) which point back at NetBox, and all of those links will break when we upgrade. It's a big ask for us to upgrade and then trawl through all our docs to update the links for (from a user perspective) no discernible gain. I understand you wanting to change this, and the reasons given. Perhaps the think to do is have some kind of compatibility shim that, if a URL with slugs is detected, can redirect to the URL with IDs instead? That would keep the URLs working, possibly even indefinitely. I think we'd be happy to sacrifice some performance in terms of the extra redirect just to avoid having to spend hours updating all the documentation.
adam added the status: acceptedtype: featurebeta labels 2025-12-29 19:19:54 +01:00
adam closed this issue 2025-12-29 19:19:54 +01:00
Author
Owner

@jeremystretch commented on GitHub (Apr 6, 2021):

Perhaps the think to do is have some kind of compatibility shim that, if a URL with slugs is detected, can redirect to the URL with IDs instead?

Yeah, I think that's a reasonable solution. Accessing /dcim/sites/raleigh-nc/ would redirect to /dcim/sites/489/, for example. The only potential hiccup would be for an object with an entirely numeric slug (which would be interpreted as a primary key), though that seems like it would be pretty uncommon.

@jeremystretch commented on GitHub (Apr 6, 2021): > Perhaps the think to do is have some kind of compatibility shim that, if a URL with slugs is detected, can redirect to the URL with IDs instead? Yeah, I think that's a reasonable solution. Accessing `/dcim/sites/raleigh-nc/` would redirect to `/dcim/sites/489/`, for example. The only potential hiccup would be for an object with an entirely numeric slug (which would be interpreted as a primary key), though that seems like it would be pretty uncommon.
Author
Owner

@jeremystretch commented on GitHub (Apr 8, 2021):

There are only three models significantly affected by the switch from slugs to PKs:

  • circuits.Provider
  • dcim.Site
  • tenancy.Tenant

These are the only three models with individual object views accessed via slug. (Many of the organizational models employed slugs for their edit/delete/changelog URLs, however these are unlikely to be directly referenced outside the NetBox UI.) I'm working on adding a simple slug-based redirection view for these three models.

@jeremystretch commented on GitHub (Apr 8, 2021): There are only three models significantly affected by the switch from slugs to PKs: * circuits.Provider * dcim.Site * tenancy.Tenant These are the only three models with individual object views accessed via slug. (Many of the organizational models employed slugs for their edit/delete/changelog URLs, however these are unlikely to be directly referenced outside the NetBox UI.) I'm working on adding a simple slug-based redirection view for these three models.
Author
Owner

@bootc commented on GitHub (Apr 8, 2021):

Thanks very much!

@bootc commented on GitHub (Apr 8, 2021): Thanks very much!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4724