cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

API - Block a device from an SSID

SOLVED
Highlighted
Here to help

API - Block a device from an SSID

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:

 

DevPolicy.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
Here to help

Re: API - Block a device from an SSID

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:)
parsed.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

3 REPLIES 3
Highlighted
Building a reputation

Re: API - Block a device from an SSID

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

Here to help

Re: API - Block a device from an SSID

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:)
parsed.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

Highlighted
New here

Re: API - Block a device from an SSID

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?

Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.