How to create a REST API session on Poly G series endpoints using Postman.

preview_player
Показать описание
How to create a REST API session on Poly G series endpoints. G7500, X30 and X50 REST API from Postman.

Page 111:
Рекомендации по теме
Комментарии
Автор

Just in case anyone hasn't worked this out, take the session ID and add it to your next request headers as Cookie: session_id=yoursessionid. That'll do the trick. Postman is caching the cookie and sending it with the next request, but not all software does that (Node-RED for example). Don't forget to clean up sessions!! You can also increase the number of concurrent sessions on the unit and set the idle timeout low so you don't build up sessions on the unit. Check the settings :)

fullmetal-fred
Автор

At the moment, I figured out that I needed to do two requests. The first one is to authenticate (this video), then I can create a second request (I use "/rest/system/reboot") with no auth and it will work in Postman.

EDIT: So! I got it working in a Python script. I used the "Requests" module.

login = requests.post(url, data=credentials, verify=False)

the credentials is a json object with user and password, verify is false because I don't have SSL verification enabled. So now "login" contains the json object of the connection, including the sessionId. So now, I'm ready for the next command in the script:

headers = {
'Cookie': 'session_id=' +
}
action = requests.post(urlReboot, headers=headers, data=payload, verify=False)

So the header now contains that cookie, and I use json parsing from the Requests module to get the sessionId (it's nested inside the "session" table, hence the double get function)

Then it should finally return {success: true}... and the Poly Studio reboots of course

TuxMan
Автор

is there a way to update the custom firmware url in the device settings via API?

dantesinfernal
Автор

Critically needed afterwards is how to use that sessionID. Ubi Son has determined that it is in a cookie, but then what are the requirements of said cookie?

PascalVerdieu
Автор

great but how do you use the session id

ubison
join shbcf.ru