Create a Meraki REST API wrapper for the device 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}/networks`
const rateLimiter = {
enabled: true
}
const deviceEndpoints = require('./lib/rest/devices')({ 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 device 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 device ressource
- Type
- Object
Methods
(static) claimNetworkDevice(apiKeyopt, targetopt, scopeopt, networkId, deviceSerial) → {Promise}
- Source:
Claim a device into 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 for which to list the devices |
|
deviceSerial |
string | The serial number of the device to claim into the network |
Returns:
A promise with no data
- Type
- Promise
(static) deleteNetworkDevice(apiKeyopt, targetopt, scopeopt, networkId, deviceSerial) → {Promise}
- Source:
Remove a single network device.
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 devices |
|
deviceSerial |
string | The serial number of the device to remove from the network |
Returns:
A promise with no data
- Type
- Promise
(static) listNetworkDevices(apiKeyopt, targetopt, scopeopt, networkId) → {Promise}
- Source:
List the devices in a network.
Example
Example response
[
{
"name":"My AP",
"lat":37.4180951010362,
"lng":-122.098531723022,
"serial":"Q2XX-XXXX-XXXX",
"mac":"00:11:22:33:44:55:66",
"model":"MR34",
"address":"1600 Pennsylvania Ave",
"lanIp":"1.2.3.4"
"tags":" recently-added ",
"networkId":"N_1234",
"beaconIdParams": {
"uuid": "00000000-0000-0000-0000-000000000000",
"major": 5,
"minor": 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 devices |
Returns:
A promise holding the devices of this network
- Type
- Promise
(static) listNetworkDeviceUplinks(apiKeyopt, targetopt, scopeopt, networkId, deviceSerial) → {Promise}
- Source:
Return an array containing the uplink information for a device.
Example
Example response
[
{
"interface":"WAN 1",
"status":"Active",
"ip":"10.0.0.0",
"gateway":"10.0.0.1",
"publicIp":"123.123.123.1",
"dns":"8.8.8.8, 8.8.4.4",
"usingStaticIp":true
},
{
"interface":"WAN 2",
"status":"Ready",
"ip":"10.0.4.2",
"gateway":"10.0.4.1",
"publicIp":"123.123.123.2",
"dns":"8.8.8.8",
"usingStaticIp":false
}
]
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 devices |
|
deviceSerial |
string | The serial number of the device for which to show the uplink details |
Returns:
A promise holding the uplink information of this network device
- Type
- Promise
(static) showNetworkDevice(apiKeyopt, targetopt, scopeopt, networkId, deviceSerial) → {Promise}
- Source:
Return a single network device.
Example
Example response
{
"name":"My AP",
"lat":37.4180951010362,
"lng":-122.098531723022,
"serial":"Q2XX-XXXX-XXXX",
"mac":"00:11:22:33:44:55:66",
"model":"MR34",
"address":"1600 Pennsylvania Ave",
"lanIp":"1.2.3.4"
"tags":" recently-added ",
"networkId":"N_1234",
"beaconIdParams": {
"uuid": "00000000-0000-0000-0000-000000000000",
"major": 5,
"minor": 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 devices |
|
deviceSerial |
string | The serial number of the device for which to show the details |
Returns:
A promise holding the device of this network
- Type
- Promise
(static) showNetworkDeviceLLDPandCDP(apiKeyopt, targetopt, scopeopt, networkId, deviceSerial, timespan) → {Promise}
- Source:
List LLDP and CDP information for a device.
Example
Example response
{
"sourceMac": "e0:55:3d:8c:df:5b",
"ports": {
"8": {
"cdp": {
"deviceId": "e0553d8cdf53",
"portId": "Port 10",
"address": "192.168.127.4",
"sourcePort": "8"
}
},
"12": {
"cdp": {
"deviceId": "e0553d8cdf53",
"portId": "Port 11",
"address": "192.168.127.4",
"sourcePort": "12"
},
"lldp": {
"systemName": "Meraki MS350-24X - Phineas",
"portId": "11",
"managementAddress": "192.168.127.4",
"sourcePort": "12"
}
}
}
}
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 devices |
|
deviceSerial |
string | The serial number of the device for which to show the lldp and cdp information |
|
timespan |
number | The timespan for which LLDP and CDP information will be fetched. Must be in seconds and less than or equal to a month (2592000 seconds). LLDP and CDP information is sent to the Meraki dashboard every 10 minutes. In instances where this LLDP and CDP information matches an existing entry in the Meraki dashboard, the data is updated once every two hours. Meraki recommends querying LLDP and CDP information at an interval slightly greater than two hours, to ensure that unchanged CDP / LLDP information can be queried consistently. |
Returns:
A promise holding the lldp and cdp information for this network device
- Type
- Promise
(static) updateNetworkDevice(apiKeyopt, targetopt, scopeopt, networkId, deviceSerial, name, tags, lat, lng, address, moveMapMarker) → {Promise}
- Source:
Update the attributes of a device.
Examples
Example device data
{
"name": "Your AP",
"lat": 37.4180951010362,
"lng": -122.098531723022,
"serial": "Q2XX-XXXX-XXXX",
"mac": "00:11:22:33:44:55:66",
"tags": " recently-added "
}
Example response
{
"name":"Your AP",
"tags":" recently-added ",
"lat":37.4180951010362,
"lng":-122.098531723022,
"serial":"Q2XX-XXXX-XXXX",
"mac":"00:11:22:33:44:55:66",
"model":"MR34",
"address":"1600 Pennsylvania Ave",
"moveMapMarker": true,
"lanIp":"1.2.3.4"
}
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 devices |
|
deviceSerial |
string | The serial number of the network device to update |
|
name |
string | The name of a device |
|
tags |
string | The tags of a device |
|
lat |
number | The latitude of a device |
|
lng |
number | The longitude of a device |
|
address |
string | The address of a device |
|
moveMapMarker |
boolean | Whether or not to set the latitude and longitude of a device based on the new address. Only applies when lat and lng are not specified. |
Returns:
A promise holding the update network device
- Type
- Promise