/networks/{networkId}/vlans ressource unavailable while /networks/{networkId}/devices available

SOLVED
Adrien-40
Conversationalist

/networks/{networkId}/vlans ressource unavailable while /networks/{networkId}/devices available

Hi All,

 

This piece of code works:

 

 

apiURL='https://api.meraki.com' 

apiRessourcepath='/api/v1/networks/'+str(networkID)+'/devices' 
myheaders={'X-Cisco-Meraki-API-Key' : main.myAPIKEY} 
response = requests.request("GET",apiURL+apiRessourcepath,headers=myheaders) 
myresponse = response.json()

 

 

but this one retrieves an error 404:

 

 

  apiURL='https://api.meraki.com'

  apiRessourcepath='/api/v1/networks/'+str(networkID)+'/vlans'
  myheaders={'X-Cisco-Meraki-API-Key' : main.myAPIKEY}
  print(apiURL+apiRessourcepath)
  response = requests.request("GET",apiURL+apiRessourcepath,headers=myheaders)

 

 

Do you have an idea why? it is written in python. same api-key, same network ID value, etc. Only the endpoint ressource changes.

 

Happy to get any clue.

Regards

Adrien

 

1 ACCEPTED SOLUTION
rhbirkelund
Kind of a big deal

As far as I recall, there is no endpoint "/networks/{networkID}/vlans"

 

Perhaps you are looking for this one? https://developer.cisco.com/meraki/api-v1/#!get-network-appliance-vlans

That endpoint is

/networks/{networkId}/appliance/vlans

So in your case the code would be;

apiURL='https://api.meraki.com'

apiRessourcepath='/api/v1/networks/'+str(networkID)+'/appliance/vlans'
myheaders={'X-Cisco-Meraki-API-Key' : main.myAPIKEY}
print(apiURL+apiRessourcepath)
response = requests.request("GET",apiURL+apiRessourcepath,headers=myheaders)
LinkedIn ::: https://blog.rhbirkelund.dk/

Like what you see? - Give a Kudo ## Did it answer your question? - Mark it as a Solution 🙂

All code examples are provided as is. Responsibility for Code execution lies solely your own.

View solution in original post

8 REPLIES 8
RaphaelL
Kind of a big deal
Kind of a big deal

Hi ,


Is there a MX in  that network ? Is it configured in routed mode ?

 

there are at least two MX. I don't know if they are in routed mode. I can ask

Yes, they are in routed mode, as per template

rhbirkelund
Kind of a big deal

As far as I recall, there is no endpoint "/networks/{networkID}/vlans"

 

Perhaps you are looking for this one? https://developer.cisco.com/meraki/api-v1/#!get-network-appliance-vlans

That endpoint is

/networks/{networkId}/appliance/vlans

So in your case the code would be;

apiURL='https://api.meraki.com'

apiRessourcepath='/api/v1/networks/'+str(networkID)+'/appliance/vlans'
myheaders={'X-Cisco-Meraki-API-Key' : main.myAPIKEY}
print(apiURL+apiRessourcepath)
response = requests.request("GET",apiURL+apiRessourcepath,headers=myheaders)
LinkedIn ::: https://blog.rhbirkelund.dk/

Like what you see? - Give a Kudo ## Did it answer your question? - Mark it as a Solution 🙂

All code examples are provided as is. Responsibility for Code execution lies solely your own.

According to https://api.meraki.com/api/v0/openapiSpec , the endpoint should be available.unless I missed something important.

 

I'll try your proposal, but I need to find out the answer to the previous question of Raphael

 

RaphaelL
Kind of a big deal
Kind of a big deal

You shouldn't use v0 it is deprecated. 

😮I think Cisco should  update the link here: https://developer.cisco.com/meraki/api-v1/#!sdks-overview   then!!!! thanks for the hint.

it worked. Thank you!

Get notified when there are additional replies to this discussion.