Network Config Template API/Download

Solved
Craiegg
Getting noticed

Network Config Template API/Download

Hello,

I am looking to download all the network configuration templates that I have created in my Organisation.

At present, the only available API is to download or get the details of Organization Templates and not Network Config templates as per my understanding and reading of the documentation of API V1.

Could someone let me know if there is any other way to do the same or if this is in the pipeline of the API being created.

 

 

Attaching a reference image of the same.

Craiegg_0-1597717594825.png

 

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

In that list is the network ID for each template.

 

You then use the normal network APIs to get the configuration.

View solution in original post

12 Replies 12
PhilipDAth
Kind of a big deal
Kind of a big deal

I don't understand clearly.

 

You have either an organisation template or a standard network that you use as a template.  The standard network is just that - a standard network.

 

Perhaps check out my backup script.

https://www.ifm.net.nz/cookbooks/meraki-backup.html 

Craiegg
Getting noticed

As I am just learning about this, maybe I was not clear enough.

What I have done is created different network templates having different settings. As shown in the image below:

Craiegg_0-1597734828953.png


As a safety measure, I would like to have a copy of the settings of each of these templates via API saved onto my local server/system. Just wanted to know if the same is possible.


I have checked the /organizations/{organizationId}/configTemplates endpoint but this does not show me the output in the image and the settings of each of those networks.

Hope this provides some clarity into the situation.


@PhilipDAth for some reason, when I run that script in cmd, it just throws a blank output with no error etc.

PhilipDAth
Kind of a big deal
Kind of a big deal

That API should return the list of templates.

Craiegg
Getting noticed

@PhilipDAth ,

For some weird reason it doesn't, it just returns a list of those 4-5 templates, but not the configurations of those templates and the rules set to apply to the devices within them. I'm not at my desk at the moment. But I'll send a grab of the output as soon as possible.

 

If you have any suggestions, would be welcomed.

PhilipDAth
Kind of a big deal
Kind of a big deal

In that list is the network ID for each template.

 

You then use the normal network APIs to get the configuration.

david_n_m_bond
Building a reputation

This "solution" is incorrect.

 

There is NO WAY to achieve what OP is asking for.  The API is broken in two places:

 

  1. Networks should return the currently-bound configuration template, e.g. as a "configurationTemplate" field, but doesn't (https://developer.cisco.com/meraki/api-v1/#!get-network)
  2. There should be a new endpoint:
    1. /organizations/{organizationId}/configTemplates/{configTemplateId}/networkbindings

Ideally, these fixes should be implemented in both v0 and v1.

Author, https://www.nuget.org/packages/Meraki.Api/
chengineer
Meraki Alumni (Retired)
Meraki Alumni (Retired)

You can get the orgs of a network to see which networks are bound to which templates. As for retrieving the configs of templates (or networks/devices), you will need to make multiple API calls. Here's an example solution that does this.

Solutions Architect @ Cisco Meraki | API & Developer Ecosystem
david_n_m_bond
Building a reputation

@chengineer ,

 

Do you mean the networks of an organization?

 

/organizations/{organizationId}/networks ?

 

This returns (e.g.) the following:

 

[ { "id": "L_123456", "organizationId": "2930418", "name": "Long Island Office", "timeZone": "America/Los_Angeles", "tags": [ "tag1", "tag2" ], "productTypes": [ "appliance", "switch", "wireless" ], "enrollmentString": "long-island-office" } ]

 

Please point out which of these returned fields represents the Configuration Template associated with "Long Island Office"?

 

As far as I can see, this does NOT contain information about the associated Configuration Template.

Author, https://www.nuget.org/packages/Meraki.Api/
chengineer
Meraki Alumni (Retired)
Meraki Alumni (Retired)

Yes, networks of an org, I misspoke/mistyped there. The sample response doesn't include configTemplateId because it's an example of a network that's not bound to a template, but for those networks that are bound to a template, that field is returned. Try it out and you'll see. 😀

Solutions Architect @ Cisco Meraki | API & Developer Ecosystem
david_n_m_bond
Building a reputation

@chengineer 

 

That's great news - thanks!  Where is that documented, please?

Author, https://www.nuget.org/packages/Meraki.Api/
PhilipDAth
Kind of a big deal
Kind of a big deal
dephinust
Conversationalist

Hi @chengineer 

 

I am looking to achieve the same thing, I want to retrieve the configurations (vlan subnets, firewall rules, etc) from multiple configuration templates. I tried running the backup_configs.py and I got the vlans id list back and the DHCP settings although I didn't get the vlan subnets back. Is this achievable? 

Get notified when there are additional replies to this discussion.