Create a Meraki REST API wrapper for the client 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 clientEndpoints = require('./lib/rest/clients')({ 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 client 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 client ressource
- Type
- Object
Methods
(static) listClients(apiKeyopt, targetopt, scopeopt, deviceSerial, timespan) → {Promise}
- Source:
List the clients of a device, up to a maximum of a month ago. The usage of each client is returned in kilobytes. If the device is a switch, the switchport is returned; otherwise the switchport field is null.
Example
Example response
[
{
"description": "Hayg's Nexus 5",
"mdnsName": "Hayg's Nexus 5",
"dhcpHostname": "HaygNexus5",
"usage": {"sent": 1337.0, "recv": 7331.0},
"mac": "00:18:D3:AD:B3:3F",
"ip": "1.2.3.4",
"id": "lk12uq",
"switchport": 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 |
deviceSerial |
string | The serial number of the device for which to list the clients |
|
timespan |
number | The timespan for which clients will be fetched. Must be in seconds and less than or equal to a month (2592000 seconds) |
Returns:
A promise holding the clients for this device
- Type
- Promise
(static) showClientPolicy(apiKeyopt, targetopt, scopeopt, networkId, timespan, mac) → {Promise}
- Source:
Return the policy assigned to a client on the network.
Example
Example response
{
"mac": "00:11:22:33:44:55",
"type": "Group policy",
"groupPolicyId": 101
}
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 clients |
|
timespan |
number | The timespan for which clients will be fetched. Must be in seconds and less than or equal to a month (2592000 seconds) |
|
mac |
string | The mac address of the client for which to show the assigned policy |
Returns:
A promise holding the clients policy group
- Type
- Promise
(static) showClientSplashAuthorization(apiKeyopt, targetopt, scopeopt, networkId, timespan, mac) → {Promise}
- Source:
Return the splash authorization for a client, for each SSID they've associated with through splash.
Example
Example response
{
"ssids": {
"0": {
"isAuthorized": true,
"authorizedAt": "2017-07-19 16:24:13 UTC",
"expiresAt": "2017-07-20 16:24:13 UTC"
},
"2": {
"isAuthorized": 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 clients |
|
timespan |
number | The timespan for which clients will be fetched. Must be in seconds and less than or equal to a month (2592000 seconds) |
|
mac |
string | The mac address of the client for which to show the assigned policy |
Returns:
A promise holding splash authorization information for this client
- Type
- Promise
(static) updateClientPolicy(apiKeyopt, targetopt, scopeopt, networkId, timespan, mac, devicePolicy, groupPolicyId) → {Promise}
- Source:
Update the policy assigned to a client on the network.
Example
Example response
{
"mac": "00:11:22:33:44:55",
"type": "Group policy",
"groupPolicyId": 101
}
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 clients |
|
timespan |
number | The timespan for which clients will be fetched. Must be in seconds and less than or equal to a month (2592000 seconds) |
|
mac |
string | The mac address of the client for which to show the assigned policy |
|
devicePolicy |
string | The group policy (Whitelisted, Blocked, Normal, Group policy) |
|
groupPolicyId |
number | [optional] If devicePolicy param is set to |
Returns:
A promise holding the updated clients policy group
- Type
- Promise
(static) updateClientSplashAuthorization(apiKeyopt, targetopt, scopeopt, networkId, mac, ssids) → {Promise}
- Source:
Update a client's splash authorization.
Examples
Example ssids data
{
"ssids": {
"0": {
"isAuthorized": true
},
"2": {
"isAuthorized": false
}
}
}
Example response
{
"ssids": {
"0": {
"isAuthorized": true,
"authorizedAt": "2017-07-19 16:24:13 UTC",
"expiresAt": "2017-07-20 16:24:13 UTC"
},
"2": {
"isAuthorized": 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 clients |
|
mac |
string | The mac address of the client for which to show the assigned policy |
|
ssids |
Object | The target SSIDs. For each SSID where isAuthorized is true, the expiration time will automatically be set according to the SSID's splash frequency |
Returns:
A promise holding the updated splash authorization information for this client
- Type
- Promise