Hey,
thanks for your support!
So i added the script from dojjan.
The script is doning well and i get no errors :)
But i figured out two problems:
1.
the changes will not be saved. If i take a look at the MM Webinterface, it offers me the "pending changes" button . But if i execute the script, go to the api webinterface and do the post command:
https://IP_MM:4343/v1/configuration/object/write_memory?config_path=%2Fmd%2FTB&UIDARUBA=5e4b0198-cff4-476d-aadf-a427c24e2511
the changes will be saved.
Are the any bugs in my postcommad? Or is it necessary to do the "wr_mem" in a separate script?
2. How do i kick out connected users of the SSID? The SSID is only for guests and should change daily.
I hope you can help me a nother time ;)
Thanks
import requests
import json
#EDIT THESE VARIABLES
#IP, username and PW for MM authentication
ip = 'ip'
username = 'username'
password = 'password'
#current ssid_profile name you want to edit
ssid_prof_name = 'Test_PW'
#new password for SSID
new_psk = '123456789'
#%2F replaces slash (below converts to /md/TB)
config_path = '%2Fmd%2FTB'
#END
baseURL = 'https://{}:4343/v1'.format(ip)
auth = {'username': username, 'password': password}
s = requests.Session()
login = s.post('{}/api/login'.format(baseURL), data=auth, verify=False)
loginData = json.loads(login.content)
cookie = loginData['_global_result']['UIDARUBA']
payload = {
"ssid_prof": [
{
"profile-name": ssid_prof_name,
"_action": "add",
"wpa_passphrase": {
"wpa-passphrase": new_psk,
"_action": "add"
}
}
]
}
data_set = s.post('{}/configuration/object?config_path={}&UIDARUBA={}'.format(baseURL, config_path, cookie), json=payload, verify=False)
print(data_set.content)
wm_call = s.post("{}configuration/object/write_memory?config_path={}&UIDARUBA={}".format(baseURL, config_path, cookie))
print(wm_call.content)
logout = s.post('{}/api/logout'.format(baseURL), data=auth, verify=False)
print("Logout Status: ", logout.status_code)
print("############################")
print("############################")