Create a Meraki REST API wrapper for the network ressource. See the online documentation for more information.
- Source:
Example
const apiKey = 'secret meraki api key'
const organizationId = 'meraki organization id'
const version = 'v0'
const target = 'n12'
const basePath = `/${target}/${version}`
const rateLimiter = {
enabled: true
}
const networkEndpoints = require('./lib/rest/networks')({ apiKey, target, basePath, baseUrl, rateLimiter })
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
apiKey |
string |
<optional> |
''
|
The Meraki api key |
target |
string |
<optional> |
'api'
|
The Meraki target |
basePath |
string |
<optional> |
'/'
|
The Meraki base path for the network ressource |
rateLimiter |
string | The rate limiter (bottleneck) configuration |
||
logger |
object |
<optional> |
Logger to use if logging is enabled |
Returns:
The initialized Meraki REST API wrapper for the network ressource
- Type
- Object
Methods
(static) bindNetworkToTemplate(apiKeyopt, targetopt, scopeopt, networkId, configTemplateId, autoBind) → {Promise}
- Source:
Bind a network to a template.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
apiKey |
string |
<optional> |
Optional custom apiKey for this request (if not set will take the inital apiKey) |
target |
string |
<optional> |
Optional custom target for this request (if not set will take the inital target) |
scope |
string |
<optional> |
Optional custom scope for rate limiter |
networkId |
string | The id of the network to bind to the template |
|
configTemplateId |
string | The ID of the template to which the network should be bound |
|
autoBind |
boolean | Optional boolean indicating whether the network's switches should automatically bind to profiles of the same model. Defaults to false if left unspecified. This option only affects switch networks and switch templates. Auto-bind is not valid unless the switch template has at least one profile and has at most one profile per switch model |
Returns:
A promise with no data
- Type
- Promise
(static) createNetwork(apiKeyopt, targetopt, scopeopt, orgId, name, type, timeZone, tags, copyFromNetworkId) → {Promise}
- Source:
Create a network.
Examples
Example network data
{
"name": "My network",
"type": "wireless",
"tags": "tag1 tag2"
}
Example response
{
"id":"N_1234",
"organizationId":"1234",
"type": "wireless",
"name":"My network",
"timeZone": "US/Pacific",
"tags": null
}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
apiKey |
string |
<optional> |
Optional custom apiKey for this request (if not set will take the inital apiKey) |
target |
string |
<optional> |
Optional custom target for this request (if not set will take the inital target) |
scope |
string |
<optional> |
Optional custom scope for rate limiter |
orgId |
string | The organization id |
|
name |
string | The name of the new network |
|
type |
string | The type of the new network. Valid types are |
|
timeZone |
string | The timezone of the network. For a list of allowed timezones, please see the 'TZ' column in the table in this article |
|
tags |
string | A space-separated list of tags to be applied to the network |
|
copyFromNetworkId |
string | The ID of the network to copy configuration from. Other provided parameters will override the copied configuration, except type which must match this network's type exactly |
Returns:
A promise holding the newly create network details
- Type
- Promise
(static) deleteNetwork(apiKeyopt, targetopt, scopeopt, networkId) → {Promise}
- Source:
Delete a network.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
apiKey |
string |
<optional> |
Optional custom apiKey for this request (if not set will take the inital apiKey) |
target |
string |
<optional> |
Optional custom target for this request (if not set will take the inital target) |
scope |
string |
<optional> |
Optional custom scope for rate limiter |
networkId |
string | The id of the network to remove |
Returns:
A promise with no data
- Type
- Promise
(static) listNetworkAccessPolicies(apiKeyopt, targetopt, scopeopt, networkId) → {Promise}
- Source:
List the access policies for this network. Only valid for MS networks.
Example
Example response
[
{
"number": 1,
"name": "Access policy 1",
"accessType": "8021.x",
"guestVlan": 3700,
"radiusServers": [
{
"ip": "1.2.3.4",
"port": 1337
},
{
"ip": "2.3.4.5",
"port": 1337
}
]
},
{
"number": 2,
"name": "Access policy 2",
"accessType": "MAC authentication bypass",
"guestVlan": 1661,
"radiusServers": [
{
"ip": "4.5.6.7",
"port": 2222
}
]
}
]
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
apiKey |
string |
<optional> |
Optional custom apiKey for this request (if not set will take the inital apiKey) |
target |
string |
<optional> |
Optional custom target for this request (if not set will take the inital target) |
scope |
string |
<optional> |
Optional custom scope for rate limiter |
networkId |
string | The id of the network for which to list the access policies |
Returns:
A promise holding the network access policies
- Type
- Promise
(static) listNetworks(apiKeyopt, targetopt, scopeopt, orgId, configTemplateId) → {Promise}
- Source:
List the networks in an organization.
Example
Example response
[
{
"id":"N_1234",
"organizationId":"1234",
"type": "wireless",
"name":"My network",
"timeZone": "US/Pacific",
"tags": null
}
]
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
apiKey |
string |
<optional> |
Optional custom apiKey for this request (if not set will take the inital apiKey) |
target |
string |
<optional> |
Optional custom target for this request (if not set will take the inital target) |
scope |
string |
<optional> |
Optional custom scope for rate limiter |
orgId |
string | The organization id |
|
configTemplateId |
string | An optional parameter that is the ID of a config template. Will return all networks bound to that template |
Returns:
A promise holding the networks this organization
- Type
- Promise
(static) listSiteToSiteVpn(apiKeyopt, targetopt, scopeopt, networkId) → {Promise}
- Source:
List the site-to-site VPN settings of a network. Only valid for MX networks.
Example
Example response
{
"mode": "spoke",
"hubs": [
{
"hubId": "N_4901849",
"useDefaultRoute": true
},
{
"hubId": "N_1892489",
"useDefaultRoute": false
}
],
"subnets": [
{
"localSubnet": "192.168.1.0/24",
"useVpn": true
},
{
"localSubnet": "192.168.128.0/24",
"useVpn": true
}
]
}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
apiKey |
string |
<optional> |
Optional custom apiKey for this request (if not set will take the inital apiKey) |
target |
string |
<optional> |
Optional custom target for this request (if not set will take the inital target) |
scope |
string |
<optional> |
Optional custom scope for rate limiter |
networkId |
string | The id of the network for which to list the site-to-site VPN settings |
Returns:
A promise holding the network site-to-site VPN settings
- Type
- Promise
(static) listTrafficAnalysis(apiKeyopt, targetopt, scopeopt, networkId, timespan, deviceType) → {Promise}
- Source:
The traffic analysis data for this network. Traffic Analysis with Hostname Visibility must be enabled on the network.
Example
Example response
[
{
"application": "Gmail",
"destination": null,
"protocol": "TCP",
"port": 443,
"sent": 100,
"recv": 200,
"numClients": 7,
"activeTime": 77000,
"flows": 300
},
{
"application": "ICMP",
"destination": "wired.meraki.com",
"protocol": "ICMP",
"port": null,
"sent": 11,
"recv": 20,
"numClients": 1,
"activeTime": 7,
"flows": 3
}
]
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
apiKey |
string |
<optional> |
Optional custom apiKey for this request (if not set will take the inital apiKey) |
target |
string |
<optional> |
Optional custom target for this request (if not set will take the inital target) |
scope |
string |
<optional> |
Optional custom scope for rate limiter |
networkId |
string | The id of the network for which to list the traffic analysis |
|
timespan |
number | The timespan for the data. Must be an integer representing a duration in seconds between two hours and one month. (Mandatory.) |
|
deviceType |
number | Filter the data by device type: combined (default), wireless, switch, appliance. When using combined, for each rule the data will come from the device type with the most usage. |
Returns:
A promise holding the network traffic analysis data
- Type
- Promise
(static) showNetwork(apiKeyopt, targetopt, scopeopt, networkId) → {Promise}
- Source:
Return a network.
Example
Example response
{
"id":"N_1234",
"organizationId":"1234",
"type": "wireless",
"name":"My network",
"timeZone": "US/Pacific",
"tags": null
}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
apiKey |
string |
<optional> |
Optional custom apiKey for this request (if not set will take the inital apiKey) |
target |
string |
<optional> |
Optional custom target for this request (if not set will take the inital target) |
scope |
string |
<optional> |
Optional custom scope for rate limiter |
networkId |
string | The id of the network to return |
Returns:
A promise holding the network details
- Type
- Promise
(static) unbindNetworkFromTemplate(apiKeyopt, targetopt, scopeopt, networkId) → {Promise}
- Source:
Unbind a network from a template.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
apiKey |
string |
<optional> |
Optional custom apiKey for this request (if not set will take the inital apiKey) |
target |
string |
<optional> |
Optional custom target for this request (if not set will take the inital target) |
scope |
string |
<optional> |
Optional custom scope for rate limiter |
networkId |
string | The id of the network to unbind |
Returns:
A promise with no data
- Type
- Promise
(static) updateNetwork(apiKeyopt, targetopt, scopeopt, networkId, name, timeZone, tags) → {Promise}
- Source:
Update a network.
Examples
Example network data
{
"id": "N_1234",
"organizationId": 1234,
"name": "My network",
"tags": "tag1 tag2"
}
Example response
{
"id":"N_1234",
"organizationId":"1234",
"type": "wireless",
"name":"My network",
"timeZone": "US/Pacific",
"tags": null
}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
apiKey |
string |
<optional> |
Optional custom apiKey for this request (if not set will take the inital apiKey) |
target |
string |
<optional> |
Optional custom target for this request (if not set will take the inital target) |
scope |
string |
<optional> |
Optional custom scope for rate limiter |
networkId |
string | The id of the network to update |
|
name |
string | The name of the new network |
|
timeZone |
string | The timezone of the network. For a list of allowed timezones, please see the 'TZ' column in the table in this article |
|
tags |
string | A space-separated list of tags to be applied to the network |
Returns:
A promise holding the updated network details
- Type
- Promise
(static) updateSiteToSiteVpn(apiKeyopt, targetopt, scopeopt, networkId, mode, hubs, subnets) → {Promise}
- Source:
Update the site-to-site VPN settings of a network. Only valid for MX networks in NAT mode.
Example
Example response
{
"mode": "spoke",
"hubs": [
{
"hubId": "N_4901849",
"useDefaultRoute": true
},
{
"hubId": "N_1892489",
"useDefaultRoute": false
}
],
"subnets": [
{
"localSubnet": "192.168.1.0/24",
"useVpn": true
},
{
"localSubnet": "192.168.128.0/24",
"useVpn": true
}
]
}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
apiKey |
string |
<optional> |
Optional custom apiKey for this request (if not set will take the inital apiKey) |
target |
string |
<optional> |
Optional custom target for this request (if not set will take the inital target) |
scope |
string |
<optional> |
Optional custom scope for rate limiter |
networkId |
string | The id of the network for which to update the site-to-site VPN settings |
|
mode |
string | The site-to-site VPN mode: hub, spoke, or none |
|
hubs |
array | The list of VPN hubs, in order of preference. In spoke mode, at least 1 hub is required |
|
subnets |
array | The list of subnets and their VPN presence |
Returns:
A promise holding the updated network site-to-site VPN settings
- Type
- Promise