[GH-ISSUE #165] How to reach API endpoint options with '-' in the name ? #88

Closed
opened 2026-02-27 15:46:21 +03:00 by kerem · 1 comment
Owner

Originally created by @gabrielmorin1 on GitHub (Apr 30, 2024).
Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/165

Hello,

I'm trying to use an API endpoint's option that as a dash in it's name. As it's impossible to have dashes in Python variables, I'm facing a major problem.

I have this code I wrote :

getattr(proxmox.cluster.sdn.vnets, vnet_id).subnets.post(subnet='192.168.130.0/24', type='subnet', gateway='192.168.130.1', snat='1', dnszoneprefix='zone1', dhcp_range='start-address=192.168.130.10,end-address=192.168.130.20')

And this is the documentation page I'm following for the API : https://pve.proxmox.com/pve-docs/api-viewer/#/cluster/sdn/vnets/{vnet}/subnets (POST)

The attended behavior : creates a vnet with the following parameters : subnet, type, gateway, snap, dnszoneprefix, dhcp-range.

The issue I'm facing is with the parameter dhcp_range='start-address=192.168.130.10,end-address=192.168.130.20'. When I put it, it's not recognized, because the API is waiting for dhcp-rangeans not dhcp_range. I've also tried dhcprange and dhcp.range but it's not working.

I read about the 'dotted notation' in the documentation but my programming skills are not good enough to determine if this method can work and if, how ; because from what I'm understanding I'm playing with endpoint options and not endpoint itself.

Many thanks in advance for your answers,

Best regards

Originally created by @gabrielmorin1 on GitHub (Apr 30, 2024). Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/165 Hello, I'm trying to use an API endpoint's option that as a dash in it's name. As it's impossible to have dashes in Python variables, I'm facing a major problem. I have this code I wrote : ``` getattr(proxmox.cluster.sdn.vnets, vnet_id).subnets.post(subnet='192.168.130.0/24', type='subnet', gateway='192.168.130.1', snat='1', dnszoneprefix='zone1', dhcp_range='start-address=192.168.130.10,end-address=192.168.130.20') ``` And this is the documentation page I'm following for the API : https://pve.proxmox.com/pve-docs/api-viewer/#/cluster/sdn/vnets/{vnet}/subnets (POST) The attended behavior : creates a vnet with the following parameters : subnet, type, gateway, snap, dnszoneprefix, dhcp-range. The issue I'm facing is with the parameter `dhcp_range='start-address=192.168.130.10,end-address=192.168.130.20'`. When I put it, it's not recognized, because the API is waiting for `dhcp-range`ans not `dhcp_range`. I've also tried `dhcprange` and `dhcp.range` but it's not working. I read about the 'dotted notation' in the documentation but my programming skills are not good enough to determine if this method can work and if, how ; because from what I'm understanding I'm playing with endpoint options and not endpoint itself. Many thanks in advance for your answers, Best regards
kerem 2026-02-27 15:46:21 +03:00
Author
Owner

@jhollowe commented on GitHub (May 1, 2024):

For a hyphen in a path name, this is covered in the proxmoxer docs

for a hyphen in a parameter name, see my answer in another issue: https://github.com/proxmoxer/proxmoxer/issues/159#issuecomment-1981198470

<!-- gh-comment-id:2087866883 --> @jhollowe commented on GitHub (May 1, 2024): For a hyphen in a path name, this is covered in the [proxmoxer docs](https://proxmoxer.github.io/docs/latest/basic_usage/#invalid-names-in-python) for a hyphen in a parameter name, see my answer in another issue: https://github.com/proxmoxer/proxmoxer/issues/159#issuecomment-1981198470
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/proxmoxer#88
No description provided.