Venafi / VenafiPS

Powershell module to fully automate your Venafi TLS Protect Datacenter and Cloud platforms!
https://venafips.readthedocs.io/
Apache License 2.0
18 stars 7 forks source link

Bug in Invoke-VenafiRestMethod #191

Closed Saadi6 closed 1 year ago

Saadi6 commented 1 year ago

Environment

Operating System: Windows Server
VenafiPS version: 5.2.1
PowerShell version: 5.1
TPP version (if applicable): 22.4

Steps to reproduce

Use a method in Venafi TPP WebSDK that expects Post method with JSON payload in body. For e.g. Metadata/UpdateItem

Expected behavior

Invoked method is executed, JSON in body is posted and the result is returned.

Actual behavior

JSON body is not sent by VenafiPS.

More Info

I think the bug is on line 209 in Invoke-VenafiRestMethod.ps1. It should be

$params.Body = $restBody

instead of

$params.Body = $Body
gdbarron commented 1 year ago

The Body parameter is a hashtable. Are you trying to send actual JSON for the body instead of a hashtable, one of the values is json? Please provide the full command you are running. Also, please try with the latest release.

Saadi6 commented 1 year ago

I am sending hash table to the function. Version 5.4.1 fixed the issue, thanks!