New To Using API

Solved
USMC92
Getting noticed

New To Using API

Hey Everyone!

Complete newb, and new to using API's.  Using Postman, and made it through the Meraki lab pretty decently; however, to run commands against our organizations, networks, etc. what is the proper URL for the GET command?  I have the OrgID, and tried using basic Auth, but I still receive 404 Error message?

1 Accepted Solution
jdsilva
Kind of a big deal

That doesn't look right. Key should be "X-Cisco-Meraki-API-Key".

View solution in original post

15 Replies 15
Adam
Kind of a big deal

My preferred method is to test a query in postman.  Once I'm getting the desired result I then click the small orange 'Code' link in the top right of postman and it'll bring up a box.  Then you can click the drop-down and select the language you want to use (HTTP, Python, PHP, Java, etc...) and it'll generate a code snippet for you to use.

 

Capture.PNG

Adam R MS | CISSP, CISM, VCP, MCITP, CCNP, ITILv3, CMNO
If this was helpful click the Kudo button below
If my reply solved your issue, please mark it as a solution.
USMC92
Getting noticed

I appreciate the tip, but still having trouble accessing our organizations, and networks.  No matter what I enter, I'm constantly returning a 404.  Should I be using https://dashboard.meraki.com/api/v0 or https://api.meraki.com/api/v0?  This is where my hangup is.

vassallon
Kind of a big deal

Based on the documentation I would say you need to use the https://api.meraki.com/api/v0?  address.

 

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

 

Actually this is even better documentation on how to get setup to use the API.

 

https://create.meraki.io/build/meraki-postman-collection-getting-started/

Found this helpful? Give me some Kudos! (click on the little up-arrow below)
jdsilva
Kind of a big deal

I'll throw this out there too just in case it's relevant.

 

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

 

404: Not found- No such URL, or you don't have access to the API or organization at all

 

If you're getting a 404 you may have the correct URL but you may not be using the correct API key, or you're sending it incorrectly. If you are using  https://api.meraki.com/api/v0? and still getting a 404 then check this.

lpopejoy
A model citizen

I believe you need to verify that you have the API enabled in the organization and that you are using the correct API key.  I've seen both of these give 404 errors with the API.

USMC92
Getting noticed

I have full access administrative privileges, so I know that's not the issue.  I'm using the following GET string:

https://api.meraki.com/api/v0/organizations

 

Headers:

Key: x-api-key

Value:  <my api key>

Key: Content-Type

Value: application/json

 

Authorization is set to: inherit auth from parent

I'm wondering if this needs to be changed to Basic Auth and enter my username & password, but when I do that, there's no change in the output.

jdsilva
Kind of a big deal

That doesn't look right. Key should be "X-Cisco-Meraki-API-Key".

USMC92
Getting noticed

And that was the issue!!  

jdsilva
Kind of a big deal

Adam
Kind of a big deal

Good eye @jdsilva

 

My original screenshot had the right variables for reference as well. The only things I changed was the xxx for security. 

Adam R MS | CISSP, CISM, VCP, MCITP, CCNP, ITILv3, CMNO
If this was helpful click the Kudo button below
If my reply solved your issue, please mark it as a solution.
jdsilva
Kind of a big deal

@Adam thanks dude. I got lucky there. I've been trying to learn myself some Python this week and it was just Monday I was playing around with the API a bit. Last week I never would known that 🙂

Adam
Kind of a big deal


@jdsilva wrote:

@Adam thanks dude. I got lucky there. I've been trying to learn myself some Python this week and it was just Monday I was playing around with the API a bit. Last week I never would known that 🙂


Agreed, making better use of the API stuff has been looming on my todo list for a while now.  I'd like to build some internal dashboards to monitor network uplink status, WAN IPs, highest traffic clients in a short time period, offline devices etc.  

Adam R MS | CISSP, CISM, VCP, MCITP, CCNP, ITILv3, CMNO
If this was helpful click the Kudo button below
If my reply solved your issue, please mark it as a solution.
USMC92
Getting noticed

That is my goal as well, and now that I have API access I can start playing around.  I plan on moving away from Postman and utilizing PS instead.

lpopejoy
A model citizen

Auth should be "no auth" - at least that's what I use. 

 

Just because you have full admin privilege, doesn't mean you have API access.  You have to enable that separately under Organization->Settings, I believe.

fidel
Comes here often

I have tried all the javascript code snippets from postman but still not working yet i get a good result from postman software itself. I have actually written my entire codes in javascript hence would not like to switch to any other language. Is there any help

Get notified when there are additional replies to this discussion.