#get config to the switch of cisco sandbox APIC_EM 's Rest_API information #you can use the postman to check the https'problem or the python scripts problem
#!/usr/bin/python3
import requests
import json
requests.packages.urllib3.disable_warnings()
#the url of APIC_EM's API interface
apic_em_ip = "https://devnetapi.cisco.com/sandbox/apic_em/api/v1"
token = response["response"]["serviceTicket"]
return token
#get the device_id
def get_device_id(token,url):
api_call = "/network-device"
#post the token number
header = {"content-type":"application/json","X-Auth-Token":token}
url += api_call
response = requests.get(url, headers=header, verify=False).json()
#get the device id
for item in response["response"]:
if item['role'] == 'ACCESS':
return item['id']