API and SDN subnet

robkooper

New Member
Mar 23, 2025
2
0
1
I'm trying to use a script to create a SDN with a specific subnet. I got all of it working except for the dhcp-range of the subnet:

Code:
curl --fail-with-body -X POST -H "Authorization: PVEAPIToken=${PROXMOX_TOKEN=$}" \
     "${PROXMOX_URL}api2/json/cluster/sdn/vnets/${SDN_NAME}/subnets?type=subnet&subnet=10.0.0/24}&gateway=10.0.0.1&snat=1&dhcp-range=start-address=10.0.0.50,end-address=10.0.0.200"

dhcp-range=10.0.0.50,10.0.0.200
dhcp-range=10.0.0.50-10.0.0.200
dhcp-range=start-address=10.0.0.50,end-address=10.0.0.200

I tried many different version (minus the correct one), but always got the following error:
{"errors":{"dhcp-range[0]":"invalid format - value without key, but schema does not define a default key\n"},"data":null}

Any hints?
Rob
 
Finally found the right incantation, and needed to url encode the dhcp-range:
dhcp-range=start-address%3D10.0.0.50%2Cend-address%3D10.0.0.200