cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
586
Views
0
Helpful
3
Replies

Secure Endpoint API Error

DMontalbano
Level 1
Level 1

I have been using the Powershell code below to access Secure Endpoint to do maintenance tasks for a couple of years now.  Removing dups, exporting computers...etc.  As of a few days ago I am getting a "Invoke-RestMethod : The remote server returned an error: (500) Internal Server Error" when it tries to run the Invoke-RestMethod command below.  Has anything changed in accessing using the API?

Function Computerlist {
$list=$null
$url="https://api.amp.cisco.com/v1/computers"
Log "Retrieving Computers list"
$list = Invoke-RestMethod -Method Get -Uri $url -Headers $Headers -ErrorVariable RestError -ErrorAction SilentlyContinue
if ($RestError){
$HttpStatusCode = $RestError.ErrorRecord.Exception.Response.StatusCode.value__
$HttpStatusDescription = $RestError.ErrorRecord.Exception.Response.StatusDescription
Log " - Unable to retrieve the computer list"
Log " - Http Status Code: $($HttpStatusCode) - Http Status Description: $($HttpStatusDescription)"
Log "Exiting the script"
Exit
}

3 Replies 3