<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Secure Endpoint API Error in Endpoint Security</title>
    <link>https://community.cisco.com/t5/endpoint-security/secure-endpoint-api-error/m-p/4964658#M7997</link>
    <description>&lt;P&gt;Seems like you might be hitting a rate limit.&amp;nbsp; The response headers should show how many requests you have remaining and the time until the count resets.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://developer.cisco.com/docs/secure-endpoint/#!overview/rate-limits" target="_blank"&gt;https://developer.cisco.com/docs/secure-endpoint/#!overview/rate-limits&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Here is a screenshot of my headers (from a request in Postman).&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MatthewFranks_0-1700683198321.png" style="width: 400px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/203127iE8D1E4A32E1EECBE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MatthewFranks_0-1700683198321.png" alt="MatthewFranks_0-1700683198321.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You should also get a 429 response if you hit the rate limit so you may need to add handling for that scenario in your script so it can sleep until the counter resets and then try again.&lt;/P&gt;
&lt;P&gt;Hope that helps.&lt;/P&gt;
&lt;P&gt;-Matt&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Nov 2023 20:01:12 GMT</pubDate>
    <dc:creator>Matthew Franks</dc:creator>
    <dc:date>2023-11-22T20:01:12Z</dc:date>
    <item>
      <title>Secure Endpoint API Error</title>
      <link>https://community.cisco.com/t5/endpoint-security/secure-endpoint-api-error/m-p/4963868#M7993</link>
      <description>&lt;P&gt;I have been using the Powershell code below to access Secure Endpoint to do maintenance tasks for a couple of years now.&amp;nbsp; Removing dups, exporting computers...etc.&amp;nbsp; 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.&amp;nbsp; Has anything changed in accessing using the API?&lt;/P&gt;&lt;P&gt;Function Computerlist {&lt;BR /&gt;$list=$null&lt;BR /&gt;$url="&lt;A href="https://api.amp.cisco.com/v1/computers" target="_blank" rel="noopener"&gt;https://api.amp.cisco.com/v1/computers&lt;/A&gt;"&lt;BR /&gt;Log "Retrieving Computers list"&lt;BR /&gt;$list = Invoke-RestMethod -Method Get -Uri $url -Headers $Headers -ErrorVariable RestError -ErrorAction SilentlyContinue&lt;BR /&gt;if ($RestError){&lt;BR /&gt;$HttpStatusCode = $RestError.ErrorRecord.Exception.Response.StatusCode.value__&lt;BR /&gt;$HttpStatusDescription = $RestError.ErrorRecord.Exception.Response.StatusDescription&lt;BR /&gt;Log " - Unable to retrieve the computer list"&lt;BR /&gt;Log " - Http Status Code: $($HttpStatusCode) - Http Status Description: $($HttpStatusDescription)"&lt;BR /&gt;Log "Exiting the script"&lt;BR /&gt;Exit&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 17:07:51 GMT</pubDate>
      <guid>https://community.cisco.com/t5/endpoint-security/secure-endpoint-api-error/m-p/4963868#M7993</guid>
      <dc:creator>DMontalbano</dc:creator>
      <dc:date>2023-11-21T17:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: Secure Endpoint API Error</title>
      <link>https://community.cisco.com/t5/endpoint-security/secure-endpoint-api-error/m-p/4964094#M7994</link>
      <description>&lt;P&gt;I just ran an API call to the /v1/computers endpoint with Powershell and received results with no issues.&amp;nbsp; As far as I know, nothing has changed that would break this API call. I modified it slightly to show a count if it succeeds and have the auth and headers above this code block.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;$list=$null
$url="https://api.amp.cisco.com/v1/computers"
Write-Host "Retrieving Computers list"
$list = Invoke-RestMethod -Method Get -Uri $url -Headers $Headers -ErrorVariable RestError -ErrorAction SilentlyContinue
if ($RestError){
    Write-Host $RestError
    $HttpStatusCode = $RestError.ErrorRecord.Exception.Response.StatusCode.value__
    $HttpStatusDescription = $RestError.ErrorRecord.Exception.Response.StatusDescription
    Write-Host " - Unable to retrieve the computer list"
    Write-Host " - Http Status Code: $($HttpStatusCode) - Http Status Description: $($HttpStatusDescription)"
    Write-Host "Exiting the script"
    Exit
}
else {
    Write-Host $list.data.count
}&lt;/LI-CODE&gt;
&lt;P&gt;Here are the results.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;.\test.ps1
Retrieving Computers list
9&lt;/LI-CODE&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;-Matt&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 19:14:27 GMT</pubDate>
      <guid>https://community.cisco.com/t5/endpoint-security/secure-endpoint-api-error/m-p/4964094#M7994</guid>
      <dc:creator>Matthew Franks</dc:creator>
      <dc:date>2023-11-21T19:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: Secure Endpoint API Error</title>
      <link>https://community.cisco.com/t5/endpoint-security/secure-endpoint-api-error/m-p/4964643#M7996</link>
      <description>&lt;P&gt;Thanks Matt.&amp;nbsp; It's very inconsistent.&amp;nbsp; It ran once today with no issues.&amp;nbsp; Ran it again and it crashed after reading 2500 records.&amp;nbsp; Other times it crashes and didn't read any records.&amp;nbsp; I'll keep troubleshooting.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 19:32:08 GMT</pubDate>
      <guid>https://community.cisco.com/t5/endpoint-security/secure-endpoint-api-error/m-p/4964643#M7996</guid>
      <dc:creator>DMontalbano</dc:creator>
      <dc:date>2023-11-22T19:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Secure Endpoint API Error</title>
      <link>https://community.cisco.com/t5/endpoint-security/secure-endpoint-api-error/m-p/4964658#M7997</link>
      <description>&lt;P&gt;Seems like you might be hitting a rate limit.&amp;nbsp; The response headers should show how many requests you have remaining and the time until the count resets.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://developer.cisco.com/docs/secure-endpoint/#!overview/rate-limits" target="_blank"&gt;https://developer.cisco.com/docs/secure-endpoint/#!overview/rate-limits&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Here is a screenshot of my headers (from a request in Postman).&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MatthewFranks_0-1700683198321.png" style="width: 400px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/203127iE8D1E4A32E1EECBE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MatthewFranks_0-1700683198321.png" alt="MatthewFranks_0-1700683198321.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You should also get a 429 response if you hit the rate limit so you may need to add handling for that scenario in your script so it can sleep until the counter resets and then try again.&lt;/P&gt;
&lt;P&gt;Hope that helps.&lt;/P&gt;
&lt;P&gt;-Matt&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 20:01:12 GMT</pubDate>
      <guid>https://community.cisco.com/t5/endpoint-security/secure-endpoint-api-error/m-p/4964658#M7997</guid>
      <dc:creator>Matthew Franks</dc:creator>
      <dc:date>2023-11-22T20:01:12Z</dc:date>
    </item>
  </channel>
</rss>

