10-15-2019 07:29 AM
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.
10-15-2019 08:31 AM
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 codesSource:
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/
10-15-2019 07:44 AM
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?
10-15-2019 08:24 AM
Ok Thanks it is working now. What measures i can take to prevent to exceed API limit.
10-15-2019 08:31 AM
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 codesSource:
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/
10-15-2019 11:31 AM
>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.
11-25-2019 06:48 AM
how i can access Retry-After header
11-25-2019 08:56 AM
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"]
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide