Ability to add interfaces using name_pattern via the API #2979

Closed
opened 2025-12-29 18:24:19 +01:00 by adam · 1 comment
Owner

Originally created by @nathbooth on GitHub (Oct 28, 2019).

Environment

  • Python version: 3.7.4
  • NetBox version: 2.6.5

Within the core Netbox Functionality it is possible to create interfaces for both devices and device types using a pattern to provide a bulk addition of interfaces matching said pattern. I propose that this functionality is cascaded to the API models for ​/dcim​/interfaces​/ and dcim​/interface-templates​/ allowing the bulk addition of interfaces without providing repetitive API calls to achieve the same result.

Proposed Functionality

Allow pattern as a nested field in the JSON request, if the pattern is defined create the pattern of interfaces.

{
	"device_type": "1234"
	"name": {
		"pattern": "ge-0/0/[0-47]"
	},
	"form_factor": 1000,
	"type": 1000,
	"mgmt_only": false
}

Use Case

Bulk addition of interfaces to devices and device types from the API

Database Changes

None

External Dependencies

None

Originally created by @nathbooth on GitHub (Oct 28, 2019). ### Environment * Python version: 3.7.4 * NetBox version: 2.6.5 Within the core Netbox Functionality it is possible to create interfaces for both devices and device types using a pattern to provide a bulk addition of interfaces matching said pattern. I propose that this functionality is cascaded to the API models for ​/dcim​/interfaces​/ and dcim​/interface-templates​/ allowing the bulk addition of interfaces without providing repetitive API calls to achieve the same result. ### Proposed Functionality Allow pattern as a nested field in the JSON request, if the pattern is defined create the pattern of interfaces. ```json { "device_type": "1234" "name": { "pattern": "ge-0/0/[0-47]" }, "form_factor": 1000, "type": 1000, "mgmt_only": false } ``` ### Use Case Bulk addition of interfaces to devices and device types from the API ### Database Changes None ### External Dependencies None
adam closed this issue 2025-12-29 18:24:19 +01:00
Author
Owner

@jeremystretch commented on GitHub (Oct 28, 2019):

This would violate one of the fundamental principles of the REST API: One JSON object represents exactly one database object. It would also greatly complicate the serialization and validation logic needed within the API, so I have to reject it.

@jeremystretch commented on GitHub (Oct 28, 2019): This would violate one of the fundamental principles of the REST API: One JSON object represents exactly one database object. It would also _greatly_ complicate the serialization and validation logic needed within the API, so I have to reject it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2979