Meraki API Support

rahirahisystems
Conversationalist

Meraki API Support

I am trying to do API Access for Meraki switch+AP that I have. 

I created an organization through the web-UI and I could see it there. When I try to do a get of that - its failing

with 404 - not found. Please let me know what I am missing. 

 

Here is my curl command

 

curl -v -L -H 'X-Cisco-Meraki-API-Key: <mykeyhere>' -X GET -H 'Content-Type: application/json' 'https://api.meraki.com/api/v0/organizations'

 

curl -v -L -H 'X-Cisco-Meraki-API-Key: {61f0c114336be2a5828f9e95388dca8d0f91178b}' -X GET -H 'Content-Type: application/json' 'https://api.meraki.com/api/v0/organizations'
Note: Unnecessary use of -X or --request, GET is already inferred.
* Trying 209.206.53.98...
* TCP_NODELAY set
* Connected to api.meraki.com (209.206.53.98) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: OU=Domain Control Validated; OU=EssentialSSL Wildcard; CN=*.meraki.com
* start date: Sep 5 00:00:00 2019 GMT
* expire date: Sep 4 23:59:59 2021 GMT
* subjectAltName: host "api.meraki.com" matched cert's "*.meraki.com"
* issuer: C=GB; ST=Greater Manchester; L=Salford; O=Sectigo Limited; CN=Sectigo RSA Domain Validation Secure Server CA
* SSL certificate verify ok.
> GET /api/v0/organizations HTTP/1.1
> Host: api.meraki.com
> User-Agent: curl/7.64.1
> Accept: */*
> X-Cisco-Meraki-API-Key: {61f0c114336be2a5828f9e95388dca8d0f91178b}
> Content-Type: application/json
>
< HTTP/1.1 404 Not Found
< Server: nginx
< Date: Tue, 28 Jan 2020 02:19:44 GMT
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Vary: Accept-Encoding
< X-UA-Compatible: IE=Edge,chrome=1
< Cache-Control: no-cache
< X-Request-Id: 98a9a7365f5d9b26b81900e6d46beb56
< X-Runtime: 0.025251
<
* Connection #0 to host api.meraki.com left intact
* Closing connection 0

7 REPLIES 7
Kamome
Building a reputation

Have you tried in this form? (Without braces in API key)

curl -v -L -H 'X-Cisco-Meraki-API-Key: 61f0c114336be2a5828f9e95388dca8d0f91178b' -X GET -H 'Content-Type: application/json' 'https://api.meraki.com/api/v0/organizations'

Thanks - I did try that part before. Not sure what the issue was, but it worked when I tried today. Thanks for your response. 

PhilipDAth
Kind of a big deal
Kind of a big deal

A 404 often means the API key is wrong.  It is likely not happy with that bit.

DensyoV
Meraki Employee
Meraki Employee

Hi,

 

I get a response while testing this from Postman so I can confirm your API key is correct. As mentioned, please ensure your parameter is correct.

Here is the response I get.

 

        "id""915420",
        "name""WiteSand",
 

Please refrain from sharing your API key as it is used for authenticating your org. since it has been shared already., kindly generate a new one.

 

https://documentation.meraki.com/zGeneral_Administration/Other_Topics/The_Cisco_Meraki_Dashboard_API

 

Thanks,

Denis 

Please hit kudos if you found this post helpful and/or click "accept as solution" if this solved your problem.

Its just a small test network with just 2 switches. Thanks for the response, I will change the key.
Nash
Kind of a big deal

Just a recommendation. Even if you're using a test environment API key, I'd get in the habit now of redacting it from code samples that you post. If you always redact your API key, then you don't run the risk of accidentally sharing the real thing.

PhilipDAth
Kind of a big deal
Kind of a big deal

This is actually a perfect lead in and reason for my suggested approach to API key handling.

https://community.meraki.com/t5/Developers-APIs/A-newer-safer-way-to-access-the-dashboard-API/m-p/69... 

Get notified when there are additional replies to this discussion.
Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.
Labels