meraki / dashboard-api-python

Official Dashboard API library (SDK) for Python
MIT License
289 stars 151 forks source link

Some insight APIs return "404 Not Found" with SDK even though API key is correct #199

Closed keita-na closed 1 year ago

keita-na commented 1 year ago

Hi team,

When I perform following Meraki Insight API with python SDK (version 1.27.0 as of today), I get 404 error even though API key is correct. Older versions of the SDK such as 1.22.1 are also affected.

https://developer.cisco.com/meraki/api-v1/#!get-organization-insight-applications https://developer.cisco.com/meraki/api-latest/#!get-network-insight-application-health-by-time

Here is the actual return that I had. 2023-01-25 15:10:49 meraki: ERROR > insight, getNetworkInsightApplicationHealthByTime - 404 Not Found, b'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtm'

2023-01-25 15:02:03 meraki: ERROR > insight, getOrganizationInsightApplications - 404 Not Found, b''

This happened with Python 3.10.0, confirmed this only happens with SDK since individual requests works fine with 200 with Postman.

Also, I don’t see this issue for another APIs such as getOrganizationNetworks. https://developer.cisco.com/meraki/api/#!get-organization-networks

TKIPisalegacycipher commented 1 year ago

Hi @keita-na I can see that GET /organizations/:organizationId/insight/applications also 404s via Postman. That means the error here isn't due to a library issue.

As for the health by time, what's the application ID you used in this case?

keita-na commented 1 year ago

Hi @TKIPisalegacycipher,

Thank you for your reply! I see 200 via Postman as attached (some info is masked), so if you try with right X-Cisco-Meraki-API-Key and organizationId, I believe it should be no problem with Postman but not SDK.

Also, you can use 19.19 for application ID to health by time which is Youtube.

Regards,

image
TKIPisalegacycipher commented 1 year ago

I'm also getting 404 via Postman on my side even with application ID 19.19. This doesn't seem to be a library-specific issue, at least on my end. I'd recommend opening a conversation with Meraki support on the behavior you've observed as a next step. I can repro this problem with Postman on my end and my org which also has Insight enabled and that's not bueno.

keita-na commented 1 year ago

This issue has already been submitted to Meraki support and I was directed to post it on this site. I checked again but I still see 200 with no issue for application ID 19.19, also confirmed even if I set a random application ID such as the attached it returns 200 without content, so it seems application ID and API itself is not a cause of this issue.

image
TKIPisalegacycipher commented 1 year ago

Hello again,

I was able to confirm that this is a bug with the endpoints themselves; they do not seem to support Bearer Auth instead of auth via the X-Cisco-Meraki-Api-Key header.

Try changing your Postman auth method to bearer auth instead of API key and I'm pretty sure you'll see the same.

All API endpoints should support Bearer Auth, so if you see further instances of this, please report them to Meraki Support. If they refer you back here then please escalate to a support manager or your account team.