Closed j-adamczyk closed 1 year ago
I checked that Postman uses n244
shard, instead of API Gateway. SDK does not work probably because routing is bugged.
Postman base URL that works: https://n244.meraki.com/api/v1
. SDK base URL that does not work: https://api.meraki.com/api/v1
.
After setting self.base_url = "https://n244.meraki.com/api/v1"
in RestSession
class instance it works, but only in some cases.
EDIT: it also requires asking for at most 500 client IDs at one time to work. This is not documented at all.
Thanks for reporting this @j-adamczyk. In Postman, if you change n244
to api
in your base URL, does Postman have the same problem?
@TKIPisalegacycipher yes, Postman does work after that change, but SDK still does not.
Thanks @j-adamczyk. Since the issue doesn't happen with api.meraki.com via Postman, that tells me it's not an api.meraki.com-specific issue.
I checked out the API endpoint itself (i.e. the docs link you shared) and by design, it returns an array, wherein each item also contains a nested array called usageHistory
. The perPage attribute will only limit the size of the top-level array. The timespan
query param, however, will limit the size of usageHistory
. I wonder if this issue is related to the Python requests
library handling a certain payload size in conjunction with an auth redirect when the usageHistory
array is very long, e.g. when the timespan is large.
When you see this issue, what is the timespan you are using?
While using api.meraki.com
, are you able to reproduce this problem with short timespans (e.g. 60 for 60 seconds)?
I am using 24 hours timespan. Interestingly, with 24 hours timespan and page size 500 (so quite large payload) it works with n244
, but not with api
.
For 60 second timespan and page size 500, I get the same error, and even for timespan 30. However, combination of page size 32 and timespan of 60 seconds returns all pages.
Would the request URI length happen to be over 8 KB?
My best guess at this time is that there's an 8KB URI size limit, but this is happening at the API level, not the SDK level. This is not something we can fix from the SDK side, so closing this out.
I would recommend splitting those requests into separate queries where URIs are <8KB.
I am getting the following error when using Python SDK (synchronous version) with getNetworkClientsUsageHistories endpoint with large number of entries per page, i.e. above 64 (docs say that 1000 is the limit):
For very small pages (e.g. 3, 16, 32) it works, but returns only the first page, even when using
total_pages="all"
. It does work in all cases (<=32 and >32 client IDs) from Postman.Whan can I do about this?