Hello !
I would like to do a script to reboot the eagleeye director, I found one for X50/G7500... that works perfectly so i changed it a little, but it has no effect on camera.
Could you confirm?
#BEGIN POWERSHELL SCRIPT FOR POLY EagleEye Director REST command
$password = "1234567" #your password
$IP = "10.35.114.88" #IP of unit
#URL to make new session
$sessionURL = ("https://" + $IP + "/api/restartSystem");
#Command to make new session
$sessionBody = "{`"user`": `"admin`",`"password`": `"" + $password + "`"}"
#URL to issue reboot
$rebootURL = ("https://" + $IP + "/api/restartSystem");
#Command to issue reboot
$rebootBody = "{`"action`": `"reboot`"}"
# disable self signed certificate check
if (-not ([System.Management.Automation.PSTypeName]'ServerCertificateValidationCallback').Type)
{
$certCallback = @"
using System;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
public class ServerCertificateValidationCallback
{
public static void Ignore()
{
if(ServicePointManager.ServerCertificateValidationCallback ==null)
{
ServicePointManager.ServerCertificateValidationCallback +=
delegate
(
Object obj,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors errors
)
{
return true;
};
}
}
}
"@
Add-Type $certCallback
}
[ServerCertificateValidationCallback]::Ignore()
# End self signed certificate commands
Invoke-WebRequest $sessionURL -ContentType "application/json" -Method Post -body $sessionBody -SessionVariable sess;
Invoke-WebRequest $rebootURL -ContentType "application/json" -Method Post -WebSession $sess -Body $rebootBody
regards
Hello @lotfi
welcome back to the Poly community,
I do not believe there is a documented REST API for the EagleEye director camera
Best Regads
Steffen Baier
If official support is required please check how to phone or open a case here
----------------Hi Steffen
There is a doc API for this but i do not understand it:
I found the script for Poly X in this community. But nothing for camera
regards
Hello @lotfi
Welcome back to the Poly community and for correcting me on the REST API for EagelEye Director.
Is this an EagleEye Director II ?
Looking at your script you are not using the correct API to log in first to the unit. You are also not using a SHA1 encrypted Password.
A working script with a hardcoded password 789 converted into SHA1 is:
#BEGIN POWERSHELL SCRIPT FOR REBOOTING Poly EagleEye Director II camera command
#The password needs to be SHA1 encrypted http://www.sha1-online.com/
#The HASH must be all lower case
#In this test script we encoded 789 into SHA1
$password = "fc1200c7a7aa52109d762a9f005b149abef01479" #your password
$IP = "192.168.0.147" #IP of unit
#URL to make new session
$sessionURL = ("https://" + $IP + "/api/login");
#Command to make new session
$sessionBody = "{`"username`": `"admin`",`"password`": `"" + $password + "`"}"
#URL to issue reboot
$rebootURL = ("https://" + $IP + "/api/restartSystem");
# disable self signed certificate check
if (-not ([System.Management.Automation.PSTypeName]'ServerCertificateValidationCallback').Type)
{
$certCallback = @"
using System;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
public class ServerCertificateValidationCallback
{
public static void Ignore()
{
if(ServicePointManager.ServerCertificateValidationCallback ==null)
{
ServicePointManager.ServerCertificateValidationCallback +=
delegate
(
Object obj,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors errors
)
{
return true;
};
}
}
}
"@
Add-Type $certCallback
}
[ServerCertificateValidationCallback]::Ignore()
# End self signed certificate commands
Invoke-WebRequest -UseBasicParsing $sessionURL -ContentType "application/json" -Method Post -body $sessionBody -SessionVariable sess;
Invoke-WebRequest -UseBasicParsing $rebootURL -ContentType "application/json" -Method Post -WebSession $sess -Body $rebootBody
A much simpler CURL example:
curl -b cookies.txt -c cookies.txt -X POST -d "{\"username\": \"admin\",\"password\": \"fc1200c7a7aa52109d762a9f005b149abef01479\"}" -H "Content-Type: application/json" -k https://192.168.0.147/api/login
curl -b cookies.txt -c cookies.txt -X POST -H "Content-Type: application/json" -k https://192.168.0.147/api/restartSystem
Best Regards
Steffen Baier
If official support is required please check how to phone or open a case here
----------------
@lotfi wrote:Hi Steffen
There is a doc API for this but i do not understand it:
https://support.polycom.com/content/dam/polycom-support/products/peripherals/eagle-eye-director-ii/u...pdf
I found the script for Poly X in this community. But nothing for camera
regards
Thank you for the helpful pdf link.