Plantronics + Polycom. Now together as Poly Logo

REST API Getting Visual+ Box Connected

Diego_A
Polycom Employee

REST API Getting Visual+ Box Connected

Hi Team! 

 

I'm new here, so sorry if this is an old topic.

 

I started to create an script to collect the Content Box (Visual+) using the RESTAPI and PowerShell (Invoke-RestMethod)

 

I know that the information for the Visual+ will be at the "mr.pair.uid.1". but I could not find any URL that provides me this info... 

 

Here is what I got so far:

$username = "Polycom"
$password = "0000" | ConvertTo-SecureString -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($username,$password)

add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;

public class IDontCarePolicy : ICertificatePolicy {
public IDontCarePolicy() {}
public bool CheckValidationResult(
ServicePoint sPoint, X509Certificate cert,
WebRequest wRequest, int certProb) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = new-object IDontCarePolicy
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls11
$IP = "172.16.182.127"
$Path = "api/v2/mgmt/device/info"
$URL = "http://$($IP)/$($Path)"
$InvokeData = Invoke-RestMethod -Method Get -Uri $URL -Credential $Cred
$data = $InvokeData.data
$data
Tags (2)
Message 1 of 3
2 REPLIES 2
Diego_A
Polycom Employee

Re: REST API Getting Visual+ Box Connected

 It took some time but I got it

 

 

 

 

$IP = "10.1.1.36" 
$PW = "0000"
$Config = "mr.pair.uid.1"

# Output Object
$Output = New-Object PSObject

$Password = $PW | ConvertTo-SecureString -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential("Polycom",$Password)

$URL = "http://$($IP)/api/v1/mgmt/config/get"

$Body = @{
    "data" = @(
        $Config
    )
}
$Json = $Body | ConvertTo-Json
$Invoke = Invoke-RestMethod -Method Post -Uri $URL -Credential $cred -TimeoutSec 8 -Body $Json -ContentType "application/json" -ErrorAction SilentlyContinue
if($Invoke.InvalidParams -like $null){
    $Output | Add-Member -type NoteProperty   -name $Config -value (($Invoke.Data).$Config).Value
    $Output | Add-Member -type NoteProperty   -name "Source" -value (($Invoke.Data).$Config).Source
}
else{
    $Output | Add-Member -type NoteProperty   -name $Config -value "Invalid Config Parameter"
}

$Output 

 

 

 

 

 

I hope that this helps others  

 

I also removed the part for the HTTPS connection:

 

 

 

 

add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;

public class IDontCarePolicy : ICertificatePolicy {
public IDontCarePolicy() {}
public bool CheckValidationResult(
ServicePoint sPoint, X509Certificate cert,
WebRequest wRequest, int certProb) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = new-object IDontCarePolicy
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls11

 

 

 

 

Message 2 of 3
SteffenBaierUK
Polycom Employee & Community Manager

Re: REST API Getting Visual+ Box Connected

Hello @Diego_A  and all,

 

we figured out there is an actual REST API command to get this info.

 

Example for CURL:

curl -k -X GET -H "Content-Type: application/JSON" https://Polycom:789456@10.252.149.59/api/v1/mgmt/mrpair/info

 

The above will respond with:

{"data": {"PairedDeviceList": [{"deviceUid": "00e0db48c130", "hardwareType": "VideoCodec", "hardwareModel": "RealPresence Group 500"}], "mrUid": "0004f2fd088c", "mrStatus": "Hub", "ConnectedDeviceList": [{"hardwareVer": "20", "mrProtocolMinor": 0, "deviceUid": "00e0db48c130", "mrIpAddress": "10.252.149.102", "mrProtocolMajor": 1, "mrPort": 18888, "connectionUpTime": 44475, "softwareRelease": "Release - 6.2.2.6-650033", "softwareDate": "2021-03-04 15:49:39-0600", "hardwareModel": "RealPresence Group 500", "ComponentList": [{"componentName": "TV UI", "componentUri": "tvui", "componentProtocolVer": "1.0", "componentType": "displayUI", "componentSerialNumber": "", "componentDetail": "", "componentVersion": ""}, {"componentName": "Group Series Content in", "componentUri": "mrCI0", "componentProtocolVer": "1.0", "componentType": "ContentInput", "componentSerialNumber": "", "componentDetail": "", "componentVersion": ""}, {"componentName": "Group Series Display", "componentUri": "mrDisplay1", "componentProtocolVer": "1.0", "componentType": "displaySink", "componentSerialNumber": "", "componentDetail": "", "componentVersion": ""}, {"componentName": "GS LEDs", "componentUri": "mrGSLedC", "componentProtocolVer": "1.0", "componentType": "led", "componentSerialNumber": "", "componentDetail": "", "componentVersion": ""}, {"componentName": "gsPTP", "componentUri": "mrPtp", "componentProtocolVer": "1.0", "componentType": "ptpControl", "componentSerialNumber": "", "componentDetail": "", "componentVersion": ""}, {"componentName": "GS system component", "componentUri": "system", "componentProtocolVer": "1.0", "componentType": "system", "componentSerialNumber": "8G180248C130CV", "componentDetail": "", "componentVersion": ""}, {"componentName": "Group Series Audio", "componentUri": "mrAudio", "componentProtocolVer": "1.0", "componentType": "audioSrcSink", "componentSerialNumber": "", "componentDetail": "Local-HDMI", "componentVersion": ""}, {"componentName": "Group Series EagleEye Camera", "componentUri": "mrCam0", "componentProtocolVer": "1.0", "componentType": "cameraSrc", "componentSerialNumber": "", "componentDetail": "", "componentVersion": "HDCI-MPTZ_EEP"}]}]}, "Status": "2000"}

Please ensure to provide some feedback if this reply has helped you so other users can profit from your experience.

Best Regards

Steffen Baier

----------------
The title Polycom 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.

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

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. If you need immediate and/or official assistance please open a service ticket through your proper support channels.
Please also ensure you always check the VoIP , Video Endpoint , Skype for Business , PSTN or RPM FAQ's
Message 3 of 3