How to determin if VLANs are enabled for a network

Solved
Gini_Dev_Team
Here to help

How to determin if VLANs are enabled for a network

Hello,

 

I am using the end-point : GET /networks/{networkId}/appliance/vlans

 

The doc describing it is there : https://developer.cisco.com/meraki/api-v1/#!get-network-appliance-vlans

 

I am only using it for MX devices.

 

It responds correctly when the VLANs are enabled,.

But in case they are not, I have the following response :

      "errors": [
        "VLANs are not enabled for this network"
      ]

 

Because I would like to not request anymore on MX devices which don't have the option enable,

I would like to have an attribute bringing this information.

Do you know if there is any end-point API which could give me such info (VLAN enable or not) ?

 

Many thanks in advance

Chris

1 Accepted Solution
daniel_abbatt
Getting noticed

You should be able to see when VLANs are enabled by looking at the settings before you make a call to the VLANs endpoint.

 

https://developer.cisco.com/meraki/api-v1/#!get-network-appliance-vlans-settings

 

It means 2 calls to the API to get VLANs though, so you may be better off just calling the VLANs endpoint and catching that error of 'VLANs are not enabled for this network'.

 

View solution in original post

4 Replies 4
GreenMan
Meraki Employee
Meraki Employee

But the call you mentioned is the one to use (?):   it told you they weren't enabled (for the Network in your query).

Maybe create a script which adds a Network tag to all those Networks which come back with VLANs enabled?

Then only use Networks with that tag, in any subsequent operations?

Good idea, but that means that I have to maintain by myself such an attribute and to periodically try again to collect data on every network_id in case of one has been activated between the 2 batchs.

 

From my point of view, this management should not have to be done by the API customer.

 

In fact this "VLAN enabled" data is a "functional data".

May be, it could be present into the response to the API end-point :  GET /organizations/{organizationId}/networks

see https://developer.cisco.com/meraki/api-v1/#!get-organization-networks

 

 

daniel_abbatt
Getting noticed

You should be able to see when VLANs are enabled by looking at the settings before you make a call to the VLANs endpoint.

 

https://developer.cisco.com/meraki/api-v1/#!get-network-appliance-vlans-settings

 

It means 2 calls to the API to get VLANs though, so you may be better off just calling the VLANs endpoint and catching that error of 'VLANs are not enabled for this network'.

 

Many thanks Daniel for this end-point that I didn't know

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.