Hello,
I implemented a Powershell code to get count of endpoints in each tenant using Sophos Central API. The code works one time per day.
Before each HTTP request to *.central.sophos.com my code waits a minute in order to avoid "TooManyRequests" error (the "Start-Sleep -s 60" Powershell command)
But I still receive the error, e.g:
{ "error": "TooManyRequests", "correlationId": "152830cb-7744-42ee-8105-3fde2dc84052", "requestId": "37df488f-5386-43e4-b777-efa2d89a3d9e" }
The error occurs only on "api-us03.central.sophos.com" host and does not occur on "api.central.sophos.com"
Please help me understand how to avoid this error?
Last such error was Oct 19th. Now I receive data successfully, thank you
Are you polling each endpoint id individually in their own request? We have a daily limit on the # of requests and the total data served per account - so if you are running sequential requests you might be hitting this limit.
RichardP
Snr. New Product Introduction Engineer | CISSP | Sophos Technical SupportSupport Videos | Product Documentation | @SophosSupport | Sign up for SMS AlertsIf a post solves your question use the 'Verify Answer' link.
No, I don't poll each endpoint. Count of my requests corresponds to count of tenants only (as I think).My algorithm contains following steps:1) Request id.sophos.com/.../token Obtaining token.2) Wait 1 minute.3) Request api.central.sophos.com/.../v1 Obtaining Partner ID.4) Wait 1 minute.5) Request api.central.sophos.com/.../tenants Obtaining list of tenants (Currently this URL returns 12 tenants)6) For each tenant:- Wait 1 minute- Request api-us03.central.sophos.com/.../endpoints Obtaining list of endpoints (currently this URL returns about 50 endpoints for each tenant)- Calculate count of endpoints grouped by "computer" and "server" type (by obtained data, without HTTP requests)- Write calculated counts into our DBOn the 6th step I receive the "TooManyRequests" error, but each day the error occurs on different tenant, sometimes the loop repeats 1 time only, but sometimes - 5 times.
How many total endpoints do you have? Also, what is the distribution amongst the tenants?
I wrote test script receiving data from one tenant per one running of script. Results:
There is 274 endpoints. Distribution is 28, 34, 57, 49, 2, 0, 55, 5, 5, 20, 19
(One tenant returns "forbidden" error and my scripts skip this tenant, its name means it was created for testing).
@Oleg - apologies - I was away for a time and didn't get back to this.
So, those numbers shouldn't be triggering the volume block for the API.
It would have to be the total # of individual transactions.
Are you still encountering the error?
Okay, let us know if it reoccurs - it might have just been a congestion issue.