I am trying to sent a Rest API Call via PowerShell Invoke-RestMethod Cmdlet but I keep getting BAD REQUEST 400 response:
RESPONSE
Object
status_code: 400
message: "Invalid document list"
I need to make this request using PowerShell because it would integrate perfectly a program I am currently working on in this language that has a windows form GUI.
I am sending some test calls to a sandbox environment and this is my current code (I am obviously omitting token and other confidential information):
$filePath = 'C:\test\ITFormAPITest.pdf';
$SandboxURL = "https://api.sandbox.signaturit.com/v3/signatures.json"
$headers = @{"Authorization"="Bearer myTOKEN"}
$Body = @{
"recipients[0][name]"="myNAME";
"recipients[0][email]"="myEMAILADDRESS";
"files[0]"= $filePath;
"subject"="Subject Test";
"body"="Please review and sign this. Thanks!"}
Invoke-RestMethod -WebSession $session -Uri $SandboxURL -Method "POST" -Body $Body -Headers $headers -ContentType "application/x-www-form-urlencoded"
Signaturit is a tool that allows to send document via email to request a digital signature from the recipient. I was able to send API requests via Postman where I can specify the key type (file or text) but I do not know how to specify the type in PowerShell and that is why when sending a rest api call, my file parameters is actually parsed as a text parameters, see screenshot below:
Any advice? I have tried to contact their support but they have nobody seems to know how to do this using PowerShell. Thanks
Please see links below on how to use the API and how to register for the sandbox: Signaturit API Instructions: https://docs.signaturit.com/api/latest#signatures_create_sign Sandbox Registration Page: https://app.sandbox.signaturit.com/en/register/personal Sandbox Environemnt Access Token Location: https://dashboard.sandbox.signaturit.com/en/#/settings/integrations