Unable to use API Key created - 404 Not Found

Solved
Craiegg
Getting noticed

Unable to use API Key created - 404 Not Found

Hello all,

I work for an MSP and we currently have 2 dashboards for our clients : Dashboard 1 ( 50 + Orgs ) , Dashboard 2 ( 2 clients ). I have created the API keys for both clients atleast a week ago

 

For dashboard one, I was able to create and successfully use the API key without any issue.

However with dashboard 2 , I have created the API key but I receive 404 error on using via Postman and even via the Python SDK.


I have added the API key in postman as well as the Python dashboard call.

Craiegg_0-1612827807929.png

 

Would anyone have any suggestions as to what is going wrong here?

Thanks,
Craig.

1 Accepted Solution
PhilipDAth
Kind of a big deal
Kind of a big deal

Something like:

 

dashboard = meraki.DashboardAPI(
	api_key=MERAKI_API_KEY,
	base_url='https://api.meraki.cn/api/v1/',
	output_log=False,
	print_console=False
)

View solution in original post

9 Replies 9
PhilipDAth
Kind of a big deal
Kind of a big deal

If it is a different API key, try regenerating the second API key.

Bruce
Kind of a big deal

Basic I know, but is the API access enabled under the Organization Settings?

Craiegg
Getting noticed

Hi @Bruce and @PhilipDAth ,

 

API access is enabled from the Organization Settings.

 

I've also tried regenerating a new API key in Dashboard 2.

 

Both don't work, one throws 404 and the other 401! 

 

Looking at the error codes it's due to invalid api key, but it's exactly the same as what is provided during creation.

 

Anything else you'd recommend to check? Bit of an odd one as I've been using the API for Dashboard one since a few months now.

Bruce
Kind of a big deal

Really scratching for ideas here. The API key is associated with a user, make sure that the user has the appropriate permissions to the organisations.

 

Craiegg
Getting noticed

Hey @Bruce 

The user has Full org access as shown below:

Craiegg_0-1612868921371.png


Another thing that I may have forgot to mention is Dashboard 1 is https://n63.meraki.com , while dashboard 2 is https://n3.meraki.cn/

Would that be causing a problem? I dont think this should cause any error though cause Im hitting the endpoint of https://api.meraki.com/api/v0/organizations

Additionally, here is a screengrab of my python script

Craiegg_0-1612869299792.png

 

 

Bruce
Kind of a big deal

I’ve just spotted that one of your Dashboard’s appears to be in China (.cn), I betting this is the issue. The is a certain amount of separation between the Meraki organisations hosted in China and those hosted elsewhere in the world... for Dashboard 2, the China hosted organisations you need to use api.meraki.cn for the API endpoints.

Craiegg
Getting noticed

Hey @Bruce 

Thanks for the suggestion, changing it to :https://api.meraki.cn/ actually worked in postman! 

Craiegg_0-1612871005626.png


For the second part of this, how do I get this working with the Python SDK, as that still throws me the 404 error? Would I have to use the Python Requests module in this case or are you aware of a workaround using the Python SDK?

PhilipDAth
Kind of a big deal
Kind of a big deal

Something like:

 

dashboard = meraki.DashboardAPI(
	api_key=MERAKI_API_KEY,
	base_url='https://api.meraki.cn/api/v1/',
	output_log=False,
	print_console=False
)
Craiegg
Getting noticed

@Bruce @PhilipDAth ,

Thanks alot for all the suggestions and help, I was successfully able to achieve what I needed to!

Cheers!

Get notified when there are additional replies to this discussion.