Make slug fields optional on REST API #7362

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

Originally created by @BegBlev on GitHub (Dec 15, 2022).

NetBox version

v3.4.0

Feature type

Change to existing functionality

Proposed functionality

Making slug fields optional or even removing them completely from Netbox is an old discussion and it will probably happen... one day. Currently, those fields are required when using the REST API. I would suggest making it optional.

Use case

Making 'slug' fields optional brings several advantages:

  • This is already the case when using GUI. 'Slug' field is not mandatory. If it is not provided it is automatically built from the name with the good format. It would be more consistent to do the same thing with the REST API.
  • This would probably ease the long way to completely remove slugs as tools will be able to progressively leave slug use. When 'all' tools using the REST API will have give up 'slug' fields, completely removing them from Netbox will be painless.
  • This would simplify tools that use Netbox REST API as they won't have to worry about slugs. For instance, I use e-breuninger Netbox Terraform provider, this provider does not compute slugs the 'right way', it just copies the name in slug. Hence, if you use forbidden characters in the names it leads to API error.

Database changes

No response

External dependencies

No response

Originally created by @BegBlev on GitHub (Dec 15, 2022). ### NetBox version v3.4.0 ### Feature type Change to existing functionality ### Proposed functionality Making slug fields optional or even removing them completely from Netbox is an old discussion and it will probably happen... one day. Currently, those fields are required when using the REST API. I would suggest making it optional. ### Use case Making 'slug' fields optional brings several advantages: - This is already the case when using GUI. 'Slug' field is not mandatory. If it is not provided it is automatically built from the name with the good format. It would be more consistent to do the same thing with the REST API. - This would probably ease the long way to completely remove slugs as tools will be able to progressively leave slug use. When 'all' tools using the REST API will have give up 'slug' fields, completely removing them from Netbox will be painless. - This would simplify tools that use Netbox REST API as they won't have to worry about slugs. For instance, I use [e-breuninger Netbox Terraform provider](https://github.com/e-breuninger/terraform-provider-netbox), this provider does not compute slugs the 'right way', it just copies the name in slug. Hence, if you use forbidden characters in the names it leads to API error. ### Database changes _No response_ ### External dependencies _No response_
adam added the type: featurestatus: duplicate labels 2025-12-29 20:22:19 +01:00
adam closed this issue 2025-12-29 20:22:19 +01:00
Author
Owner

@jeremystretch commented on GitHub (Dec 15, 2022):

Thank you for submitting this issue, however it appears that this topic has already been raised. Please see issue #8113 for further discussion.

This is already the case when using GUI. 'Slug' field is not mandatory.

There is no difference between the UI and REST API regarding required fields; both utilize the same underlying data model.

@jeremystretch commented on GitHub (Dec 15, 2022): Thank you for submitting this issue, however it appears that this topic has already been raised. Please see issue #8113 for further discussion. > This is already the case when using GUI. 'Slug' field is not mandatory. There is no difference between the UI and REST API regarding required fields; both utilize the same underlying data model.
Author
Owner

@BegBlev commented on GitHub (Dec 15, 2022):

I think the proposal is slightly different from #8113. The proposal is not to make 'slug fields optional for all data models' but only for the REST API. The DB model would stay unchanged. I understand that REST API is built from the data model but perhaps it would be possible to "overwrite" in some way the default behaviour. Actually I don't master the 'data model to REST API' process to see if this would possible.

@BegBlev commented on GitHub (Dec 15, 2022): I think the proposal is slightly different from #8113. The proposal is not to make 'slug fields optional for all data models' but only for the REST API. The DB model would stay unchanged. I understand that REST API is built from the data model but perhaps it would be possible to "overwrite" in some way the default behaviour. Actually I don't master the 'data model to REST API' process to see if this would possible.
Author
Owner

@BegBlev commented on GitHub (Dec 16, 2022):

Futhermore, it would be an important step in the 'totally remove slug from data models' direction.

@BegBlev commented on GitHub (Dec 16, 2022): Futhermore, it would be an important step in the 'totally remove slug from data models' direction.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7362