[GH-ISSUE #12] Convert Hashtables into appropriate querystring values #11

Closed
opened 2026-02-26 17:32:06 +03:00 by kerem · 0 comments
Owner

Originally created by @XNoobMaster69 on GitHub (Jan 3, 2024).
Original GitHub issue: https://github.com/Corsinvest/cv4pve-api-powershell/issues/12

What happened?

I tried to pass a <Hashtable> argument to the Module, but I kept getting a response with a status code of 400. Here's the example:

$networkConfig = @{
    1 = @{
        model = 'virtio';
        bridge = 'vmbr0';
        macaddr = $mac;
    };
}

$storageConfig = @{
    1 = 'local-lvm:32';
}

$bootableIso = @{
    1 = 'local:iso/ubuntu.iso'
}

New-PveNodesQemu -Node $node -Vmid 105 -Memory 2048 -ScsiN $storageConfig -IdeN $bootableIso -NetN $networkConfig

To resolve the issue, I received a suggestion to change the variable to $networkConfig = @{ 1 = "model=virtio,bridge=vmbr0,macaddr=$mac" } , but during debugging, I noticed that the value was not properly escaped in the URI.

The only way for $networkConfig to be accepted was to format it like this:
$networkConfig = @{ 1 = "model%3Dvirtio%2Cbridge%3Dvmbr0%2Cmacaddr%3D$mac" }

Expected behavior

Accept <Hashtable> Format and maybe add a simple example to the documentation about the correct aproach.

Relevant log output

No response

Proxmox VE Version

8.1.3

Version (bug)

8.1.0

Version (working)

No response

On what operating system are you experiencing the issue?

Windows

Pull Request

  • I would like to do a Pull Request
Originally created by @XNoobMaster69 on GitHub (Jan 3, 2024). Original GitHub issue: https://github.com/Corsinvest/cv4pve-api-powershell/issues/12 ### What happened? I tried to pass a `<Hashtable>` argument to the Module, but I kept getting a response with a status code of 400. Here's the example: ``` $networkConfig = @{ 1 = @{ model = 'virtio'; bridge = 'vmbr0'; macaddr = $mac; }; } $storageConfig = @{ 1 = 'local-lvm:32'; } $bootableIso = @{ 1 = 'local:iso/ubuntu.iso' } ``` `New-PveNodesQemu -Node $node -Vmid 105 -Memory 2048 -ScsiN $storageConfig -IdeN $bootableIso -NetN $networkConfig` To resolve the issue, I received a suggestion to change the variable to `$networkConfig = @{ 1 = "model=virtio,bridge=vmbr0,macaddr=$mac" }` , but during debugging, I noticed that the value was not properly escaped in the URI. The only way for `$networkConfig` to be accepted was to format it like this: ` $networkConfig = @{ 1 = "model%3Dvirtio%2Cbridge%3Dvmbr0%2Cmacaddr%3D$mac" } ` ### Expected behavior Accept `<Hashtable>` Format and maybe add a simple example to the documentation about the correct aproach. ### Relevant log output _No response_ ### Proxmox VE Version 8.1.3 ### Version (bug) 8.1.0 ### Version (working) _No response_ ### On what operating system are you experiencing the issue? Windows ### Pull Request - [ ] I would like to do a Pull Request
kerem closed this issue 2026-02-26 17:32:06 +03:00
Sign in to join this conversation.
No labels
bug
pull-request
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/cv4pve-api-powershell#11
No description provided.