Meraki API - Reboot SM Device using Tags

Hiren101
New here

Meraki API - Reboot SM Device using Tags

i want to restart the SM Devices (iPads) using Tags. i got the Meraki API working with Serial numbers but i want to restart using Tags. below is the code from postman.

 

import requests
import json


payload = json.dumps({
  "serials": [
    "963klu74lk"
  ],
 
  "notifyUser": "false",
  "rebuildKernelCache": "false",
  "requestRequiresNetworkTether": "true"
})
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': '••••••'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
---------------------------------------
now i want to remove the serial # and add below code
 
  "scope": [
    "withAny",
    "Test-Tag"
  ],
 
i don't know how to write the script and add the scope with tag to reboot ipads.
5 Replies 5
Mloraditch
Head in the Cloud

Based on the documentation for this api, it appears you can just replace the serial section with the scope section in your code.

 

https://developer.cisco.com/meraki/api-v1/reboot-network-sm-devices/

You can always fill out the form here with your parameters and it will output the correct JSON necessary.

If you found this post helpful, please give it Kudos. If my answer solves your problem please click Accept as Solution so others can benefit from it.
Hiren101
New here

it's giving me an error when i use

  "scope": [
    "withAny",
    "Test-Tag"
  ],
 
and remove
 
  "serials": [
    "963klu74lk"
  ],
 
also, when i try the above url i get Response: 404 not found then i use Postman app
Mloraditch
Head in the Cloud

The above URL is the documentation link not the API URL, you have the correct API URL.
Try leaving serials in with no value:

  "serials": [],
and then just adding tags.

If you import the meraki collection into postman you should be able to play around with formats and see the details on the 400 error request and then be able to just put what works into your python script.

I don't have SM devices I can reboot so I can't test myself.
If you found this post helpful, please give it Kudos. If my answer solves your problem please click Accept as Solution so others can benefit from it.
Hiren101
New here

with postman app i can use serial and it works. i want to use Tags instead of serial so i can do all iPad with tag. when i use tag i get this error. "Invalid parameters(s): scope"

Mloraditch
Head in the Cloud

I understand that. That's why I provided the above url to the documentation site, it will generate correctly formatted JSON and you can even test from there. If you are using that and it's not working, you have a support case at that point. If you do get it working you should be able to just paste the resulting json into your script.

If you found this post helpful, please give it Kudos. If my answer solves your problem please click Accept as Solution so others can benefit from it.
Get notified when there are additional replies to this discussion.