i can see the Organisations. but other API calls are not working.
because of API calls i have done. with 2000 networks in an organisation.
How i can check that my API access limit is exceeded.
Solved! Go to solution.
Here's a quote from the docs that'll help:
If the defined rate limit is exceeded, Dashboard API will reply with the 429 (rate limit exceeded) error code. This response will also return a Retry-After header indicating how long the client should wait before making a follow-up request.
response = requests.request("GET", url, headers=headers)
if response.status_code == 200:
# Success logic
elif response.status_code == 429:
time.sleep(int(response.headers["Retry-After"]))
else:
# Handle other response codes
Source:
https://documenter.getpostman.com/view/7928889/SVmsVg6K?version=latest
Another thing you should consider is using action batches. That'll help to optimize your workflow, thus lowering the amount of calls needed. Check this blog post for all info on that:
https://meraki.cisco.com/blog/2019/06/action-batches-a-recipe-for-success/
You should get an error with response code 429 instead of the normal 200 response code.
Your error is likely related to your access rights. The account linked to the API key you're using, what kind of access rights does it have to the networks you're trying to manage via API?
Ok Thanks it is working now. What measures i can take to prevent to exceed API limit.
Here's a quote from the docs that'll help:
If the defined rate limit is exceeded, Dashboard API will reply with the 429 (rate limit exceeded) error code. This response will also return a Retry-After header indicating how long the client should wait before making a follow-up request.
response = requests.request("GET", url, headers=headers)
if response.status_code == 200:
# Success logic
elif response.status_code == 429:
time.sleep(int(response.headers["Retry-After"]))
else:
# Handle other response codes
Source:
https://documenter.getpostman.com/view/7928889/SVmsVg6K?version=latest
Another thing you should consider is using action batches. That'll help to optimize your workflow, thus lowering the amount of calls needed. Check this blog post for all info on that:
https://meraki.cisco.com/blog/2019/06/action-batches-a-recipe-for-success/
>Ok Thanks it is working now. What measures i can take to prevent to exceed API limit.
Put a small delay between the API calls. A 200ms delay guarantees no problems. However as code is often busy processing other things, you can often use a smaller delay like 100ms.
how i can access Retry-After header
Well if you're using requests you can do it using, just as it says in the example I posted earlier:
response.headers["Retry-After"]