[GH-ISSUE #467] Bug: ConfigSDNZone.mapToApiValues seems broken #120

Open
opened 2026-02-28 00:40:39 +03:00 by kerem · 0 comments
Owner

Originally created by @NemoDacremont on GitHub (Oct 4, 2025).
Original GitHub issue: https://github.com/Telmate/proxmox-api-go/issues/467

I've been playing around with the terraform-provider-proxmox, and tried to add new Simple SDN Zone by using this SDK, however, I faced a problem : when trying to create the zone, the API responds with a status code 400.

After a little bit of digging, I figured out that according to the proxomx v8 api documentation and v7 api documentation, values are posted as json in the request body, and the only required fields are "type" and "zone" in the case of simple SDN.

However, these fields are removed when making the request (proxmox/config__sdn__zone.go:144) :

func (config *ConfigSDNZone) mapToApiValues() (params map[string]interface{}) {

	d, _ := json.Marshal(config)
	json.Unmarshal(d, &params)

	// ... Some code ...
	// Remove the zone and type (path parameters) from the map
	delete(params, "zone")
	delete(params, "type")
	return
}

I didn't find any reference about passing data into path parameters, so I feel like it is a bug.

After testing with the next curl command, I was able to create a SDN Zone :

curl -v -H 'Content-Type: application/json' -H 'Authorization: PVEAPIToken=[REDACTED]' -X POST https://[REDACTED]/api2/json/cluster/sdn/zones  -d '{"type":"simple","zone":"example"}'

However, this trimming is required in order to update a SDN Zone :

curl -v -H 'Content-Type: application/json' -H 'Authorization: PVEAPIToken=[REDACTED]' -X PUT https://[REDACTED]/api2/json/cluster/sdn/zones/example  -d '{"zone":"example"}'

Is it possible to find a fix ? Are you interested in reviewing a PR if I try to patch it ?

Originally created by @NemoDacremont on GitHub (Oct 4, 2025). Original GitHub issue: https://github.com/Telmate/proxmox-api-go/issues/467 I've been playing around with the terraform-provider-proxmox, and tried to add new Simple SDN Zone by using this SDK, however, I faced a problem : when trying to create the zone, the API responds with a status code 400. After a little bit of digging, I figured out that according to the proxomx [v8 api documentation](https://pve.proxmox.com/pve-docs-8/api-viewer/index.html#/cluster/sdn/zones) and [v7 api documentation](https://pve.proxmox.com/pve-docs-7/api-viewer/index.html#/cluster/sdn/zones), values are posted as json in the request body, and the only required fields are "type" and "zone" in the case of simple SDN. However, these fields are removed when making the request (`proxmox/config__sdn__zone.go:144`) : ```go func (config *ConfigSDNZone) mapToApiValues() (params map[string]interface{}) { d, _ := json.Marshal(config) json.Unmarshal(d, &params) // ... Some code ... // Remove the zone and type (path parameters) from the map delete(params, "zone") delete(params, "type") return } ``` I didn't find any reference about passing data into path parameters, so I feel like it is a bug. After testing with the next curl command, I was able to create a SDN Zone : ```sh curl -v -H 'Content-Type: application/json' -H 'Authorization: PVEAPIToken=[REDACTED]' -X POST https://[REDACTED]/api2/json/cluster/sdn/zones -d '{"type":"simple","zone":"example"}' ``` However, this trimming is required in order to update a SDN Zone : ```sh curl -v -H 'Content-Type: application/json' -H 'Authorization: PVEAPIToken=[REDACTED]' -X PUT https://[REDACTED]/api2/json/cluster/sdn/zones/example -d '{"zone":"example"}' ``` Is it possible to find a fix ? Are you interested in reviewing a PR if I try to patch it ?
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/proxmox-api-go#120
No description provided.