Skip to main content

 

Hi Everyone.

 

I’m trying to execute a worklet  through the APPI but Im only getting a bad request error. 

Any idea what could be wrong ?

 

$polid = MyPolicyWorkletID

$headers = @{ "Authorization" = "Bearer $apiKey" }

$url = "https://console.automox.com/api/policies/$polid/action?o=MyOrgID"
$body = @"
  {
      "action": "remediateServer"
      "serverId": "MyServerID"
  }
"@

Invoke-WebRequest -Method POST -Uri $url -Headers $headers -Body $body
 

Thanks for any help !!

Diego

 

 

 

Updated, still getting same error. 

 

$polid = MyPolicyWorkletID

$headers = @{ "Authorization" = "Bearer $apiKey" }

$url = "https://console.automox.com/api/policies/$polid/action?o=MyOrgID"
$body = @"
  {
      "action": "remediateServer",
      "serverId": 12345
  }
"@

Invoke-WebRequest -Method POST -Uri $url -Headers $headers -Body $body
 

 

Invoke-WebRequest : The remote server returned an error: (400) Bad Request.

 

 


 

Anyone please ?


Hi,

I do not see the $apiKey variable being defined. Can you please add that and retry?

Hope this helps.


Reply