milestonexprotectwspython.xpwservercommandservice

Module: xpwservercommandservice.py

Revision History

Date Version Description
2023/07/11 1.0.0.0 Initial Version.

@export
class XPWServerCommandService(milestonexprotectwspython.xpwwebservicebase.XPWWebServiceBase):

The Server Command Service SOAP web service provides access to XProtect Management Server functions in a given installation.

XPWServerCommandService( loginInfo: milestonexprotectwspython.xpwlogininfo.XPWLoginInfo = None)

Initializes a new instance of the class.

Arguments:
  • loginInfo (XPWLoginInfo): Login Information class that contains login token information. This class is returned on a successful call to any of the LoginX methods from classes that inherit from XPWWebServiceBase. This allows you to share the same Login Information (token, etc) between service classes.
    Specify null / None to not share Login Information; if doing so, then your first call must be to one of the Login methods (e.g. LoginBasicUser, LoginWindowsUser, etc).
    Default is null / None.
Raises:
  • XPWException: The method fails for any reason.

Returns configuration information for an XProtect Management Server.

Returns:

An XPWConfiguration class that contains server configuration details.

Raises:
  • XPWWebServiceException: The XProtect Web-Services Server returned a failed response.
  • XPWException: The method fails for any other reason.

Sample Code

# package imports.
from milestonexprotectwspython.xpwconfiguration import XPWConfiguration
from milestonexprotectwspython.xpwlogininfo import XPWLoginInfo
from milestonexprotectwspython.xpwservercommandservice import XPWServerCommandService

# create service instance and set server prefixes for our environment.
svc:XPWServerCommandService = XPWServerCommandService()
svc.ManagementServerUrlPrefix = "https://mymanagementserver.example.com"
svc.IsSslVerifyEnabled = False

# authenticate using xprotect basic auth credentials.
loginInfo:XPWLoginInfo = svc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))

# get configuration info.
cfg:XPWConfiguration = svc.GetConfiguration()
print("** Configuration Info:\n{0}\n".format(cfg))
print("**   Camera Groups:\n{0}\n".format(cfg.CameraGroups))
print("**   Input Groups:\n{0}\n".format(cfg.InputGroups))
print("**   Output Groups:\n{0}\n".format(cfg.OutputGroups))
print("**   Recorders:\n{0}\n".format(cfg.Recorders))
print("**   Speaker Groups:\n{0}\n".format(cfg.SpeakerGroups))
print("**   Licenses:\n{0}\n".format(cfg.Licenses))

def GetConfigurationHardware( self, deviceIds: list[str]) -> milestonexprotectwspython.xpwcollection.XPWCollection:

Returns configuration hardware information for an XProtect Management Server.

Arguments:
  • deviceIds (list[str]): A list of device id strings to query for configuration information.
Returns:

A collection of XPWHardware objects that contains hardware configuration details for the specified device id(s). The collection will be empty if the specified device id(s) could not be found.

Raises:
  • XPWWebServiceException: The XProtect Web-Services Server returned a failed response.
  • XPWException: deviceIds argument was not supplied.
    The method fails for any other reason.

Sample Code

# package imports.
from milestonexprotectwspython.xpwcollection import XPWCollection
from milestonexprotectwspython.xpwlogininfo import XPWLoginInfo
from milestonexprotectwspython.xpwhardware import XPWHardware
from milestonexprotectwspython.xpwservercommandservice import XPWServerCommandService

# create service instance and set server prefixes for our environment.
svc:XPWServerCommandService = XPWServerCommandService()
svc.ManagementServerUrlPrefix = "https://mymanagementserver.example.com"
svc.IsSslVerifyEnabled = False

# authenticate using xprotect basic auth credentials.
loginInfo:XPWLoginInfo = svc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))

# get hardware info.
items:XPWCollection = svc.GetConfigurationHardware(["08cf6a24-c7ab-4b50-80e0-5a56cf624c5f", "a9c997f4-c5db-49e7-9f7e-8d4474f5a13f"])
print("** Hardware Items Summary:\n{0}\n".format(items))

def GetConfigurationRecorders( self, recorderIds: list[str]) -> milestonexprotectwspython.xpwcollection.XPWCollection:

Returns configuration information for one or more XProtect Recording Servers.

Arguments:
  • recorderIds (list[str]): A list of recorder id strings to query for configuration information.
Returns:

A collection of XPWRecorder objects that contain recorder configuration details for the specified recorder id(s). The collection will be empty if the specified recorder id(s) could not be found.

Raises:
  • XPWWebServiceException: The XProtect Web-Services Server returned a failed response.
  • XPWException: recorderIds argument was not supplied.
    The method fails for any other reason.

Sample Code

# package imports.
from milestonexprotectwspython.xpwcollection import XPWCollection
from milestonexprotectwspython.xpwlogininfo import XPWLoginInfo
from milestonexprotectwspython.xpwrecorder import XPWRecorder
from milestonexprotectwspython.xpwservercommandservice import XPWServerCommandService

# create service instance and set server prefixes for our environment.
svc:XPWServerCommandService = XPWServerCommandService()
svc.ManagementServerUrlPrefix = "https://mymanagementserver.example.com"
svc.IsSslVerifyEnabled = False

# authenticate using xprotect basic auth credentials.
loginInfo:XPWLoginInfo = svc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))

# get recorder info.
items:XPWCollection = svc.GetConfigurationRecorders(["19f94d50-b5ad-4e90-8b3f-9928bb60f9f2"])
print("** Recorder Items Summary:\n{0}\n".format(items))

Returns disabled device information for an XProtect Management Server.

Returns:

A collection of XPWDeviceDisabled objects that contain disabled device configuration details. The collection will be empty if there are currently no disabled devices found.

Raises:
  • XPWWebServiceException: The XProtect Web-Services Server returned a failed response.
  • XPWException: The method fails for any other reason.

Sample Code

# package imports.
from milestonexprotectwspython.xpwcollection import XPWCollection
from milestonexprotectwspython.xpwdevicedisabled import XPWDeviceDisabled
from milestonexprotectwspython.xpwlogininfo import XPWLoginInfo
from milestonexprotectwspython.xpwservercommandservice import XPWServerCommandService

# create service instance and set server prefixes for our environment.
svc:XPWServerCommandService = XPWServerCommandService()
svc.ManagementServerUrlPrefix = "https://mymanagementserver.example.com"
svc.IsSslVerifyEnabled = False

# authenticate using xprotect basic auth credentials.
loginInfo:XPWLoginInfo = svc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))

# get disabled devices info.
items:XPWCollection = svc.GetDevicesDisabled()
print("** DeviceDisabled Items Summary:\n{0}\n".format(items))

Returns product information for an XProtect Management Server.

Returns:

An XPWProduct class that contains management server product details.

Raises:
  • XPWWebServiceException: The XProtect Web-Services Server returned a failed response.
  • XPWException: The method fails for any other reason.

Sample Code

# package imports.
from milestonexprotectwspython.xpwlogininfo import XPWLoginInfo
from milestonexprotectwspython.xpwproduct import XPWProduct
from milestonexprotectwspython.xpwservercommandservice import XPWServerCommandService

# create service instance and set server prefixes for our environment.
svc:XPWServerCommandService = XPWServerCommandService()
svc.ManagementServerUrlPrefix = "https://mymanagementserver.example.com"
svc.IsSslVerifyEnabled = False

# authenticate using xprotect basic auth credentials.
loginInfo:XPWLoginInfo = svc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))

# get product info.
pi:XPWProduct = svc.GetProductInfo()
print("** Product Info:\n{0}\n".format(pi))

def QueryRecorderInfo( self, recorderId: str) -> milestonexprotectwspython.xpwrecorder.XPWRecorder:

Returns configuration information for an XProtect Recording Server.

Arguments:
  • recorderId (str): The recorder id string of the recording server to query.
Returns:

An XPWRecorder class that contains recording server configuration details for the specified device id.

Raises:
  • XPWWebServiceException: The XProtect Web-Services Server returned a failed response.
  • XPWException: recorderId argument was not supplied.
    The method fails for any other reason.

A XPWWebServiceException will be raised if the specified recorder id could not be found.

Note that the QueryRecorderInfo only returns the base properties of the recording server configuration. It does not return collection properties (e.g. Cameras, Hardware, Inputs, Outputs, Microphones, Speakers, etc); use the GetConfiguration method to return ALL properties of a recording server.

Sample Code

# package imports.
from milestonexprotectwspython.xpwlogininfo import XPWLoginInfo
from milestonexprotectwspython.xpwrecorder import XPWRecorder
from milestonexprotectwspython.xpwservercommandservice import XPWServerCommandService

# create service instance and set server prefixes for our environment.
svc:XPWServerCommandService = XPWServerCommandService()
svc.ManagementServerUrlPrefix = "https://mymanagementserver.example.com"
svc.IsSslVerifyEnabled = False

# authenticate using xprotect basic auth credentials.
loginInfo:XPWLoginInfo = svc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))

# query recorder basic info.
recsvr:XPWRecorder = svc.QueryRecorderInfo("19f94d50-b5ad-4e90-8b3f-9928bb60f9f2")
print("** Query Recorder Info:\n{0}\n".format(recsvr))

def RegisterIntegration( self, instanceId: str, integrationId: str, integrationVersion: str, integrationName: str, manufacturerName: str) -> None:

Registers an integration for the sole purpose of getting an overview of integration usage.

Arguments:
  • instanceId (str): The globally unique identtifier identifying the calling instance.
    Typically each ID should refer to a specific machine running an integration.
  • integrationId (str): The globally unique identtifier representing the integration.
    Should be hardcoded the integrating application.
  • integrationVersion (str): Version of the calling application.
  • integrationName (str): Name of the calling application.
  • manufacturerName (str): Name of the manufacturer of the calling application.
Raises:
  • XPWWebServiceException: The XProtect Web-Services Server returned a failed response.
  • XPWException: instanceId argument is null or an empty string.
    integrationId argument is null or an empty string.
    integrationVersion argument is null or an empty string.
    integrationName argument is null or an empty string.
    manufacturerName argument is null or an empty string.
    The method fails for any other reason.

Sample Code

# package imports.
from milestonexprotectwspython.xpwlogininfo import XPWLoginInfo
from milestonexprotectwspython.xpwservercommandservice import XPWServerCommandService

# create service instance and set server prefixes for our environment.
svc:XPWServerCommandService = XPWServerCommandService()
svc.ManagementServerUrlPrefix = "https://mymanagementserver.example.com"
svc.IsSslVerifyEnabled = False

# authenticate using xprotect basic auth credentials.
loginInfo:XPWLoginInfo = svc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))

# register integration details.
svc.RegisterIntegration("00000000-0000-0000-0000-000000000001", "10000000-0000-0000-0000-000000000001", "1.0", "Milestone XProtect Python", "My Company Name")
print("** Integration Registered Successfully.")