Logo

Script for EagleEye Director

lotfi
Advisor

Script for EagleEye Director

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

Message 1 of 5
4 REPLIES 4
SteffenBaierUK
Polycom Employee & Community Manager

Re: Script for EagleEye Director

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

----------------
The title Poly Employee & Community Manager is a community setting and does not reflect my role. I am just a simple volunteer in the community like everybody else. All posts and words are my own & do not represent the views of Employer.

----------------


⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓SIGNATURE ⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓
Notice: This community forum is not an official Poly support resource, thus responses from Poly employees, partners, and customers alike are best-effort in attempts to share learned knowledge.
Please also ensure you always check the VoIP , Video Endpoint , Microsoft Voice , PSTN or other FAQ's in the different sections
Message 2 of 5
lotfi
Advisor

Re: Script for EagleEye Director

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...

 

I found the script for Poly X in this community. But nothing for camera

 

regards

Message 3 of 5
SteffenBaierUK
Polycom Employee & Community Manager

Re: Script for EagleEye Director

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

----------------
The title Poly Employee & Community Manager is a community setting and does not reflect my role. I am just a simple volunteer in the community like everybody else. All posts and words are my own & do not represent the views of Employer.

----------------


⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓SIGNATURE ⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓⇓
Notice: This community forum is not an official Poly support resource, thus responses from Poly employees, partners, and customers alike are best-effort in attempts to share learned knowledge.
Please also ensure you always check the VoIP , Video Endpoint , Microsoft Voice , PSTN or other FAQ's in the different sections
Message 4 of 5
pmuller
Occasional Visitor

Re: Script for EagleEye Director


@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. 

Message 5 of 5