cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
7095
Views
3
Helpful
4
Replies

API - Block a device from an SSID

CiscoUser14
Community Member

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:

image.png


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

1 Accepted Solution

Accepted Solutions

CiscoUser14
Community Member

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:)
image.png

Will get the result of the client having 'Normal' policy towards ssids with ID 0 and 1
'Blocked' for ssid with ID 3

View solution in original post

4 Replies 4

hody.crouch
Level 7
Level 7

The API does not appear to support setting different group policies for a client by SSID. I'm not aware of any workaround.

CiscoUser14
Community Member

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:)
image.png

Will get the result of the client having 'Normal' policy towards ssids with ID 0 and 1
'Blocked' for ssid with ID 3

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?

Gal_Tfilin
Community Member

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:

{
"mac": "aa:aa:aa:aa:aa:aa",
"devicePolicy": "Per connection",
"timespan": 2592000,
"policiesBySsid": {
"9": {
"devicePolicy": "Blocked"
}
}
}

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)

Review Cisco Networking for a $25 gift card