0

I'm trying to create a powershell script to access JoeSandBox API to download reports.

I'm following their API details there https://www.joesandbox.com/userguide?sphinxurl=usage/webapi.html

Here's the beginning of the REST script I've put together:

$json = @{
    apikey="XXXX";
    webid= "YYYY"
} | ConvertTo-Json

invoke-restmethod -uri 'https://www.joesandbox.com/api/v2/analysis/download' -Method POST -Body $json -ContentType 'multipart/form-data'

Basically, I don't get the access...

Invoke-RestMethod : {"errors":[{"code":2,"message":"apikey is required."}]}

Thanks

  • 1
    Try running a http debug proxy like Fiddler when you make the request - it will let you see what Powershell is *really* sending at the protocol level. Also, your documentation link is behind a login page - you might want to add the important parts of the page into your question so others can see it. – mclayton Oct 02 '21 at 18:09
  • I figured out with the help of Fiddler. `$body = @{'apikey'='xxxx'; 'webid'='yyyy'} invoke-restmethod -uri 'https://www.joesandbox.com/api/v2/analysis/download' -Method POST -body $body` Thanks @mclayton! – Martin Forand Oct 02 '21 at 21:38

1 Answers1

0
$body = @{'apikey'='XXX'; 'webid'='YYY'}
invoke-restmethod -uri 'https://www.joesandbox.com/api/v2/analysis/download' -Method POST -body $body