I'm trying to send a POST request to restart a phone using python:requests-module to the API and getting either "400 Bad Request" or "4000 Invalid input parameters.
This is the request.
reb = requests.post('https://10.10.10.10/api/v1/mgmt/safeReboot', json, auth=('username','password'),)
Not sure what I'm missing, but any help is appreciated.
I got this from the following document.
Using the "ucsoftware-restapi.pdf",
Management.Restart
Protocol, Method & Path
Protocol: HTTP/HTTPS
Method: POST
Path: /api/v1/mgmt/safeRestart
Input / Output Format Access Level
JSON
Input
None
Output
Applicable return codes
Success Response:
{“Status”: “2000” }
Failure Response:
{ “Status”: “5000” }
2000, 5000
Hello @Jim-D ,
Welcome to the Poly Community.
The Voice FAQ contains:
Jun 05, 2018 Question: Do Poly Phones support a REST API?
Resolution: Please => here <=
the above has examples that you can use and work your way back.
Please ensure to provide some feedback if this reply has helped you so other users can profit from your experience.
Best Regards
Steffen Baier
Thank you for your response, I've read those documents and they only say post "None" or nothing to the url - https://x.x.x.x/api/v1/mgmt/safeRestart
I'm sending:
reb = requests.post('https://x.x.x.x/api/v1/mgmt/safeReboot', "Content-Type: application/json", auth=('username','password'))
keep getting code 400 or 4000. I can issue a GET request, but for some reason I can't sent a POST. I'm not using powershell.
Any help is appreciated.
Thanks,
Jim-D,
In case it helps,
Phone Information
Phone Model: VVX 501
UC Software Version: 5.8.1.7278
Updater Version: 5.9.6.8818
Hello @Jim-D
you are using an unsupported software. Update to a currently supported software for your phone model and then test one of the examples. CURL or Power Shell and then you can work your way back with Python
replied via a mobile device
Thanks for the suggestion. Unfortunately this is the version of software on the 2000+ phones. I can not change that at this time.
I did try the powershell commands on a test windows pc and it does work, so I know the phones will respond to a saferestart api request. What I need help with is how to put that into a python request so the phone will do the same thing.
Thanks,
Jim-D,
Figured it out.
reb = requests.post('https://x.x.x.x/api/v1/mgmt/safeRestart', headers={'Content-Type' : 'applicaation/json'}, auth=('username','password'), verify=False)
I appeciate your help.
Jim-D,
Thanks for the update and quick reply. I'll be sure to keep an eye on this thread. Bumped into your thread. Thanks for creating it. Looking forward for solution.