02-17-2019 08:53 AM
I need help with blocking a device from a specific SSID using API.
There is an option to do so in the Meraki UI by selecting the client:
It does the work just fine. I am looking to find a way to do the same using an API request.
checking client policy by
/networks/[networkId]/clients/[client_mac]/policy
Before changing:
{
"mac": "__MAC___",
"type": "Normal"
}
After changing
{
"mac": "__MAC___",
"type": "Different policies by SSID",
"ssids": {
"0": {
"type": "Normal",
"name": "SSID_Name0"
},
"1": {
"type": "Normal",
"name": "SSID_Name1"
},
"3": {
"type": "Blocked",
"name": "SSID_Name3"
}
}
}
I know I can send a request with device policy being whitelisted/blocked/normal/group, but I aim for "Different policies by SSID" or any other way to achieve it, if anyone knows.
Thanks in advance
Solved! Go to Solution.
02-26-2019 01:57 AM
Thanks for trying to help, found the way.
PUT request to
api.meraki.com/api/v0/networks/{{NetworkId}}/clients/{{ClientMac}}/policy?timespan=86400&devicePolicy=Different policies by SSID
with the body
blocked_msg=&access=custom&custom_policy%5B0%5D=-1&custom_policy%5B1%5D=-1&custom_policy%5B3%5D=1&ids%5B%5D=DEVICE_ID
(when parsed it looks like this:)
Will get the result of the client having 'Normal' policy towards ssids with ID 0 and 1
'Blocked' for ssid with ID 3
02-17-2019 09:22 AM
The API does not appear to support setting different group policies for a client by SSID. I'm not aware of any workaround.
02-26-2019 01:57 AM
Thanks for trying to help, found the way.
PUT request to
api.meraki.com/api/v0/networks/{{NetworkId}}/clients/{{ClientMac}}/policy?timespan=86400&devicePolicy=Different policies by SSID
with the body
blocked_msg=&access=custom&custom_policy%5B0%5D=-1&custom_policy%5B1%5D=-1&custom_policy%5B3%5D=1&ids%5B%5D=DEVICE_ID
(when parsed it looks like this:)
Will get the result of the client having 'Normal' policy towards ssids with ID 0 and 1
'Blocked' for ssid with ID 3
12-06-2019 12:23 PM
Would love to use this myself! I'm not following the url you're using for the request. As far as I know you can't put spaces in the url, so how were you able to accomplish adding "devicePolicy=Different policies by SSID" to the end of the put request?
11-08-2021 08:25 AM
I tried @CiscoUser14 's solution and could not make it work.
However, I managed to find the documentation of that functionality under the following API:
https://developer.cisco.com/meraki/api/#!provision-network-clients
under schema definition.
You should set Per connection policy and list the SSIDs you would like to change the device's policy for them
Here is an example for a request's body that would block device for specific SSIDs:
Sending this body in a post request to /networks/{networkId}/clients/provision will block any device with MAC aa:aa:aa:aa:aa:aa from connecting to SSID on index 9(you can get that using GET /networks/{networkId}/ssids)
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide