API not retrieving all networks

Solved
Deadman
Here to help

API not retrieving all networks

Hello all! Hope you are doing well. 

 

I have been trying to retrieve my networking information from Postman, but I only get two networks out of the four when I run the GET. I'm able to access all the networks on the Meraki dashboard, but having no luck with APIs. I have created different API keys, but no luck. Any advice?

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

Then the queries would be simply : 

 

 https://api.meraki.com/api/v1/organizations/   ( with a valid API key )

https://api.meraki.com/api/v1/organizations/{organizationId}/networks ( with a valid Org ID obtained from the previous call ) 

 

Simply log into any Org that you have a API key in your browser and paste the urls in the url bar :

RaphaelL_0-1644444873258.png

This is how I test my calls before scripting.

View solution in original post

13 Replies 13
RaphaelL
Kind of a big deal
Kind of a big deal

Could you precise what API call you using ?

GET  {{baseUrl}}/organizations/

 

I got the organization ID from the Meraki Dashboard, but when I try to add it to the URL I get a 401.

 

{
"errors": [
"Invalid API key"
]
}
RaphaelL
Kind of a big deal
Kind of a big deal

So you are trying to Get https://api.meraki.com/api/v1/organizations/  which should return you a list of Orgs that you have access. Then you will be able to retrieve the ''id'' ( which is the OrgID ) and try https://api.meraki.com/api/v1/organizations/{organizationId}/networks  with the correct ID. 

 

My favorite way to test these API calls , is by using Chrome and logging to the desired Org and then typing the API url in the url bar.

Thanks for the advice. I am unsure how to test API calls from Chrome. Can you please provide a site that gives instructions? 

And I have followed the correct steps to get the Organizations back. I noticed that the n# is different for the Organizations I am trying to access. I wonder if that is where the problem is. 

No, I am not using v0. I am using v1. The GET request works for the networks that are on the same shard, but not the other two that are on different shards. 

RaphaelL
Kind of a big deal
Kind of a big deal

All networks from the same Org are on the same shard. Do not mix shards ID and Orgs. 

 

That is why it is recommended to use the mega proxy api.meraki.com instead of the shard. If you really want to use the shard , you have to make sure that it is the right one.

I am using the mega proxy api.meraki.com. 

 

I am only seeing the difference in the shard from the dashboard, so I wasn't sure if that was causing the issue. I have never used the shard in the API call. 

RaphaelL
Kind of a big deal
Kind of a big deal

Then the queries would be simply : 

 

 https://api.meraki.com/api/v1/organizations/   ( with a valid API key )

https://api.meraki.com/api/v1/organizations/{organizationId}/networks ( with a valid Org ID obtained from the previous call ) 

 

Simply log into any Org that you have a API key in your browser and paste the urls in the url bar :

RaphaelL_0-1644444873258.png

This is how I test my calls before scripting.

Wow! That was awesome. Thanks for sharing that. I got the results and the Organization was present. However, when I add the organizationId( or the organizationId/networks) I get a 404 error. 

 

I tested the method with the other networks and only one network returned with 200.

RaphaelL
Kind of a big deal
Kind of a big deal

Has the Org API settings been enabled ?  :

 

RaphaelL_0-1644446939015.png

 

Yes, it has. 

RaphaelL
Kind of a big deal
Kind of a big deal

 However, when I add the organizationId( or the organizationId/networks) I get a 404 error. 

 

I tested the method with the other networks and only one network returned with 200.

 

I'm not sure I'm following you. The call https://api.meraki.com/api/v1/organizations/{organizationId}/networks    It needs a OrgID not a NetworkID. You should be able to list all the networks from that given Org. If it still fails for the same Org , I would open a ticket.

It is working! Thank you!

 

Get notified when there are additional replies to this discussion.