Unable to create subnet via API

sudomaster.ljs

New Member
Oct 29, 2022
15
0
1
Hello All,

The vnet vnet5 exists but unable to associate the subnet 192.168.105.0/24 to the vnet.

curl -k --location --request GET 'https://192.168.xx.xx:8006/api2/json/cluster/sdn/vnets/vnet5' --header 'Authorization: PVEAPIToken=api@pve!test=xxxx'
{"data":{"tag":20005,"zone":"z10004","vnet":"vnet5","type":"vnet","alias":"vnet5","digest":"1f266f6c10c5be3ee6f0373ad969daac83b635a8"}}

But post call to /api2/json/cluster/sdn/vnets/{vnet}/subnets fails with the error 500 create sdn subnet object failed: Invalid response from server: 404 Not Found

curl --location --request POST 'https://192.168.xx.xx:8006/api2/json/cluster/sdn/vnets/vnet5/subnets' \
--header 'Authorization: PVEAPIToken=api@pve!test=xxxx' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'vnet=vnet5' \
--data-urlencode 'subnet=192.168.105.0/24' \
--data-urlencode 'type=subnet'

Am i doing something wrong? Please help!!
 
that's strange, seem to be ok.

with pvesh:

pvesh create /cluster/sdn/vnets/vnet1/subnets --subnet 10.0.0.0/8 --type subnet



maybe try to remove
--data-urlencode 'vnet=vnet5' \

as it's already on the url.