milestonexprotectrestpython.xprrestservice
Module: xprrestservice.py
Revision History
Date | Version | Description |
---|---|---|
2023/07/11 | 1.0.0.0 | Initial Version. |
The REST Service class provides access to XProtect API Gateway REST services.
Initializes a new instance of the class.
Raises:
- Exception: The method fails for any reason.
Returns configuration information for one or more Analytics Event items.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring.
Returns:
An XPRCollection class of XPRAnalyticsEvent items that contain AnalyticsEvent configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any other reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get Analytics events, both enabled and disabled.
evnts:XPRCollection = xsvc.GetAnalyticsEvents(True)
print("** AnalyticsEvents (Enabled and Disabled):\n{0}\n".format(evnts))
# get Analytics events, enabled only.
evnts:XPRCollection = xsvc.GetAnalyticsEvents(False)
print("** AnalyticsEvents (Enabled only):\n{0}\n".format(evnts))
# get Analytics events, whose displayName contains 'my'.
evnts:XPRCollection = xsvc.GetAnalyticsEvents(True, "displayName", XPRFilterOperator.contains, "my")
print("** AnalyticsEvents (whose displayName contains 'my'):\n{0}\n".format(evnts))
# get Analytics events, whose name contains 'my'.
evnts:XPRCollection = xsvc.GetAnalyticsEvents(True, "name", XPRFilterOperator.contains, "my")
print("** AnalyticsEvents (whose name contains 'my'):\n{0}\n".format(evnts))
Returns configuration information for one or more CameraGroups.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring. - parentId (str): Parent Group identifier to retrieve child group items of, or null to retrieve top level groups. Default is None.
Returns:
An XPRCollection class of XPRCameraGroup items that contain camera group configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any other reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get camera device groups, both enabled and disabled.
grps:XPRCollection = xsvc.GetCameraGroups(True)
print("** CameraGroups (Enabled and Disabled):\n{0}\n".format(grps))
# get camera device groups, enabled only.
grps:XPRCollection = xsvc.GetCameraGroups(False)
print("** CameraGroups (Enabled only):\n{0}\n".format(grps))
# get camera device groups, whose displayName contains '1080p'.
grps:XPRCollection = xsvc.GetCameraGroups(True, "displayName", XPRFilterOperator.contains, "1080p")
print("** CameraGroups (whose displayName contains '1080p'):\n{0}\n".format(grps))
# get camera device groups, whose name contains 'iPad'.
grps:XPRCollection = xsvc.GetCameraGroups(True, "name", XPRFilterOperator.contains, "iPad")
print("** CameraGroups (whose name contains 'iPad'):\n{0}\n".format(grps))
# get camera device child groups for a designated parent group id.
grps:XPRCollection = xsvc.GetCameraGroups(parentId="b6791e89-e336-44f5-adfc-0936b4472147")
print("** CameraGroups (child groups of parent group id):\n{0}\n".format(grps))
Returns configuration information for one or more Camera device MotionDetections.
Arguments:
- cameraId (str): Globally unique identifier of the camera whose MotionDetections are to be retrieved.
Returns:
An XPRCollection class of XPRMotionDetection items that contain camera motion detection configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any other reason.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get camera device motiondetections for a designated parent camera id.
motions:XPRCollection = xsvc.GetCameraMotionDetections("f0f31f69-36a2-46a3-80b6-48e4bf617db8")
print("** Camera MotionDetection (for parent camera id):\n{0}\n".format(motions))
Returns configuration information for one or more Camera devices.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring.
Returns:
An XPRCollection class of XPRCamera items that contain camera configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any other reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get camera devices, both enabled and disabled.
cams:XPRCollection = xsvc.GetCameras(True)
print("** Cameras (Enabled and Disabled):\n{0}\n".format(cams))
# get camera devices, enabled only.
cams:XPRCollection = xsvc.GetCameras(False)
print("** Cameras (Enabled only):\n{0}\n".format(cams))
# sort results by name, descending.
cams.sort(reverse=True)
print("** Cameras (Collection Sorted by: Name, descending):\n{0}\n".format(cams))
# sort results by description, ascending.
cams.sort(key=lambda x: x.Description or "")
print("** Cameras (Collection Sorted by: Description, ascending):\n{0}\n".format(cams))
# get camera devices, whose displayName property contains 'Office'.
cams:XPRCollection = xsvc.GetCameras(True, "displayName", XPRFilterOperator.contains, "Office")
print("** Cameras (whose displayName contains 'Office'):\n{0}\n".format(cams))
# get camera devices, whose name property contains 'iPad'.
cams:XPRCollection = xsvc.GetCameras(True, "name", XPRFilterOperator.contains, "iPad")
print("** Cameras (whose name contains 'iPad'):\n{0}\n".format(cams))
Returns configuration information for one or more Camera device streams.
Arguments:
- cameraId (str): Globally unique identifier of the camera whose streams are to be retrieved.
Returns:
An XPRCollection class of XPRStream items that contain camera stream configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any other reason.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get camera device streams for a designated parent camera id.
streams:XPRCollection = xsvc.GetCameraStreams("f0f31f69-36a2-46a3-80b6-48e4bf617db8")
print("** Camera Streams (for parent camera id):\n{0}\n".format(streams))
Returns configuration information for one or more Child Sites.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring. - parentId (str): Parent Site identifier to retrieve child site items of, or null to retrieve top level sites. Default is None.
Returns:
An XPRCollection class of XPRChildSite items that contain site configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any other reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get child sites, both enabled and disabled.
sites:XPRCollection = xsvc.GetChildSites(True)
print("** ChildSites (Enabled and Disabled):\n{0}\n".format(sites))
# get child sites, enabled only.
sites:XPRCollection = xsvc.GetChildSites(False)
print("** ChildSites (Enabled only):\n{0}\n".format(sites))
# get child sites, whose displayName contains 'WIN10VM'.
sites:XPRCollection = xsvc.GetChildSites(True, "displayName", XPRFilterOperator.contains, "WIN10VM")
print("** ChildSites (whose displayName contains 'WIN10VM'):\n{0}\n".format(sites))
# get child sites, whose name contains 'WIN10'.
sites:XPRCollection = xsvc.GetChildSites(True, "name", XPRFilterOperator.contains, "WIN10")
print("** ChildSites (whose name contains 'WIN10'):\n{0}\n".format(sites))
# get child sites for a designated parent site id.
sites:XPRCollection = xsvc.GetChildSites(parentId="f7587456-97e2-5e94-808f-8756a8a7c926")
print("** ChildSites (child sites of parent site id):\n{0}\n".format(sites))
Returns configuration information for one or more EventTypeGroups.
Returns:
An XPRCollection class of XPREventTypeGroup items that contain EventType group configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any other reason.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get event type groups.
grps:XPRCollection = xsvc.GetEventTypeGroups()
print("** EventTypeGroups:\n{0}\n".format(grps))
Returns configuration information for one or more EventType items.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring.
Returns:
An XPRCollection class of XPREventType items that contain EventType configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any other reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get event types, both enabled and disabled.
evntyps:XPRCollection = xsvc.GetEventTypes(True)
print("** EventTypes (Enabled and Disabled):\n{0}\n".format(evntyps))
# get event types, enabled only.
evntyps:XPRCollection = xsvc.GetEventTypes(False)
print("** EventTypes (Enabled only):\n{0}\n".format(evntyps))
# get event types, whose displayName contains 'Fire'.
evntyps:XPRCollection = xsvc.GetEventTypes(True, "displayName", XPRFilterOperator.contains, "Fire")
print("** EventTypes (whose displayName contains 'Fire'):\n{0}\n".format(evntyps))
# get event types, whose generatorType contains 'hardware'.
evntyps:XPRCollection = xsvc.GetEventTypes(True, "generatorType", XPRFilterOperator.contains, "hardware")
print("** EventTypes (whose generatorType contains 'hardware'):\n{0}\n".format(evntyps))
Returns configuration information for one or more Generic Event DataSource items.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring.
Returns:
An XPRCollection class of XPRGenericEventDataSource items that contain GenericEventDataSource configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any other reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get Generic Event DataSources, both enabled and disabled.
datsrc:XPRCollection = xsvc.GetGenericEventDataSources(True)
print("** GenericEventDataSources (Enabled and Disabled):\n{0}\n".format(datsrc))
# get Generic Event DataSources, enabled only.
datsrc:XPRCollection = xsvc.GetGenericEventDataSources(False)
print("** GenericEventDataSources (Enabled only):\n{0}\n".format(datsrc))
# get Generic Event DataSources, whose displayName contains 'my'.
datsrc:XPRCollection = xsvc.GetGenericEventDataSources(True, "displayName", XPRFilterOperator.contains, "my")
print("** GenericEventDataSources (whose displayName contains 'my'):\n{0}\n".format(datsrc))
# get Generic Event DataSources, whose name contains 'my'.
datsrc:XPRCollection = xsvc.GetGenericEventDataSources(True, "name", XPRFilterOperator.contains, "my")
print("** GenericEventDataSources (whose name contains 'my'):\n{0}\n".format(datsrc))
Returns configuration information for one or more Generic Event items.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring.
Returns:
An XPRCollection class of XPRGenericEvent items that contain GenericEvent configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any other reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get generic events, both enabled and disabled.
evnts:XPRCollection = xsvc.GetGenericEvents(True)
print("** GenericEvents (Enabled and Disabled):\n{0}\n".format(evnts))
# get generic events, enabled only.
evnts:XPRCollection = xsvc.GetGenericEvents(False)
print("** GenericEvents (Enabled only):\n{0}\n".format(evnts))
# get generic events, whose displayName contains 'my'.
evnts:XPRCollection = xsvc.GetGenericEvents(True, "displayName", XPRFilterOperator.contains, "my")
print("** GenericEvents (whose displayName contains 'my'):\n{0}\n".format(evnts))
# get generic events, whose name contains 'my'.
evnts:XPRCollection = xsvc.GetGenericEvents(True, "name", XPRFilterOperator.contains, "my")
print("** GenericEvents (whose name contains 'my'):\n{0}\n".format(evnts))
Returns configuration information for one or more Hardware devices.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring.
Returns:
An XPRCollection class of XPRHardware items that contain hardware configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get hardware, both enabled and disabled.
hdwrs:XPRCollection = xsvc.GetHardware(True)
print("** Hardware (Enabled and Disabled):\n{0}\n".format(hdwrs))
# get hardware, enabled only.
hdwrs:XPRCollection = xsvc.GetHardware(False)
print("** Hardware (Enabled only):\n{0}\n".format(hdwrs))
# get hardware, whose model contains 'Universal1ChAdv'.
hdwrs:XPRCollection = xsvc.GetHardware(True, "model", XPRFilterOperator.contains, "Universal1ChAdv")
print("** Hardware (whose model contains 'Universal1ChAdv'):\n{0}\n".format(hdwrs))
# get hardware, whose name contains 'iPad'.
hdwrs:XPRCollection = xsvc.GetHardware(True, "name", XPRFilterOperator.contains, "iPad")
print("** Hardware (whose name contains 'iPad'):\n{0}\n".format(hdwrs))
Returns configuration information for one or more InputEventGroups.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring. - parentId (str): Parent Group identifier to retrieve child group items of, or null to retrieve top level groups. Default is None.
Returns:
An XPRCollection class of XPRDeviceGroup items that contain device group configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any other reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get inputevent device groups, both enabled and disabled.
grps:XPRCollection = xsvc.GetInputEventGroups(True)
print("** InputEventGroups (Enabled and Disabled):\n{0}\n".format(grps))
# get inputevent device groups, enabled only.
grps:XPRCollection = xsvc.GetInputEventGroups(False)
print("** InputEventGroups (Enabled only):\n{0}\n".format(grps))
# get inputevent device groups, whose displayName contains 'group'.
grps:XPRCollection = xsvc.GetInputEventGroups(True, "displayName", XPRFilterOperator.contains, "group")
print("** InputEventGroups (whose displayName contains 'group'):\n{0}\n".format(grps))
# get inputevent device groups, whose name contains 'group'.
grps:XPRCollection = xsvc.GetInputEventGroups(True, "name", XPRFilterOperator.contains, "group")
print("** InputEventGroups (whose name contains 'group'):\n{0}\n".format(grps))
# get inputevent device child groups for a designated parent group id.
grps:XPRCollection = xsvc.GetInputEventGroups(parentId="e70188f7-9ae3-4e98-865f-512da8a4c831")
print("** InputEventGroups (child groups of parent group id):\n{0}\n".format(grps))
Returns configuration information for one or more InputEvent devices.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring.
Returns:
An XPRCollection class of XPRInputEvent items that contain input event configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get inputevent devices, both enabled and disabled.
inps:XPRCollection = xsvc.GetInputEvents(True)
print("** InputEvents (Enabled and Disabled):\n{0}\n".format(inps))
# get inputevent devices, enabled only.
inps:XPRCollection = xsvc.GetInputEvents(False)
print("** InputEvents (Enabled only):\n{0}\n".format(inps))
# sort results by name, descending.
inps.sort(reverse=True)
print("** InputEvents (Collection Sorted by: Name, descending):\n{0}\n".format(inps))
# sort results by description, ascending.
inps.sort(key=lambda x: x.Description or "")
print("** InputEvents (Collection Sorted by: Description, ascending):\n{0}\n".format(inps))
# get inputevent devices, whose displayName property contains 'Office'.
inps:XPRCollection = xsvc.GetInputEvents(True, "displayName", XPRFilterOperator.contains, "Office")
print("** InputEvents (whose displayName contains 'Office'):\n{0}\n".format(inps))
# get inputevent devices, whose name property contains 'iPad'.
inps:XPRCollection = xsvc.GetInputEvents(True, "name", XPRFilterOperator.contains, "iPad")
print("** InputEvents (whose name contains 'iPad'):\n{0}\n".format(inps))
Returns an Detail of all product license information.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring.
Returns:
An XPRCollection class of XPRLicenseDetail items that contain license detail configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get license details.
licdtls:XPRCollection = xsvc.GetLicenseDetails(True)
print("** License Details (Enabled and Disabled):\n{0}\n".format(licdtls))
# get license details, whose activated count is greater than 2.
licdtls:XPRCollection = xsvc.GetLicenseDetails(True, "activated", XPRFilterOperator.gt, "2")
print("** License Details (whose activated count is greater than 2):\n{0}\n".format(licdtls))
# get license details, whose activated count is less than 1.
licdtls:XPRCollection = xsvc.GetLicenseDetails(True, "activated", XPRFilterOperator.lt, "1")
print("** License Details (whose activated count is less than 1):\n{0}\n".format(licdtls))
Returns configuration information for one or more LicenseInformations.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring.
Returns:
An XPRCollection class of XPRLicenseInformation items that contain license information configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get license informations.
licnfos:XPRCollection = xsvc.GetLicenseInformations(True)
print("** License Information (Enabled and Disabled):\n{0}\n".format(licnfos))
Returns an overview of all product license information.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring.
Returns:
An XPRCollection class of XPRLicenseOverview items that contain license overview configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get license overviews.
licovrs:XPRCollection = xsvc.GetLicenseOverviews(True)
print("** License Overviews (Enabled and Disabled):\n{0}\n".format(licovrs))
Returns detailed information of all installed product licenses.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring.
Returns:
An XPRCollection class of XPRLicenseProduct items that contain license product configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get license installed products.
licprds:XPRCollection = xsvc.GetLicenseInstalledProducts(True)
print("** License Installed Products (Enabled and Disabled):\n{0}\n".format(licprds))
Returns configuration information for one or more MetadataGroups.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring. - parentId (str): Parent Group identifier to retrieve child group items of, or null to retrieve top level groups. Default is None.
Returns:
An XPRCollection class of XPRDeviceGroup items that contain device group configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get metadata device groups, both enabled and disabled.
grps:XPRCollection = xsvc.GetMetadataGroups(True)
print("** MetadataGroups (Enabled and Disabled):\n{0}\n".format(grps))
# get metadata device groups, enabled only.
grps:XPRCollection = xsvc.GetMetadataGroups(False)
print("** MetadataGroups (Enabled only):\n{0}\n".format(grps))
# get metadata device groups, whose displayName contains 'group'.
grps:XPRCollection = xsvc.GetMetadataGroups(True, "displayName", XPRFilterOperator.contains, "group")
print("** MetadataGroups (whose displayName contains 'group'):\n{0}\n".format(grps))
# get metadata device groups, whose name contains 'group'.
grps:XPRCollection = xsvc.GetMetadataGroups(True, "name", XPRFilterOperator.contains, "group")
print("** MetadataGroups (whose name contains 'group'):\n{0}\n".format(grps))
# get metadata device child groups for a designated parent group id.
grps:XPRCollection = xsvc.GetMetadataGroups(parentId="cede51f0-ae1e-44f6-ad66-461cb0f9c71c")
print("** MetadataGroups (child groups of parent group id):\n{0}\n".format(grps))
Returns configuration information for one or more Metadata devices.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring.
Returns:
An XPRCollection class of XPRMetadata items that contain metadata configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get metadata devices, both enabled and disabled.
metas:XPRCollection = xsvc.GetMetadatas(True)
print("** Metadatas (Enabled and Disabled):\n{0}\n".format(metas))
# get metadata devices, enabled only.
metas:XPRCollection = xsvc.GetMetadatas(False)
print("** Metadatas (Enabled only):\n{0}\n".format(metas))
# sort results by name, descending.
metas.sort(reverse=True)
print("** Metadatas (Collection Sorted by: Name, descending):\n{0}\n".format(metas))
# sort results by description, ascending.
metas.sort(key=lambda x: x.Description or "")
print("** Metadatas (Collection Sorted by: Description, ascending):\n{0}\n".format(metas))
# get metadata devices, whose displayName property contains 'Office'.
metas:XPRCollection = xsvc.GetMetadatas(True, "displayName", XPRFilterOperator.contains, "Office")
print("** Metadatas (whose displayName contains 'Office'):\n{0}\n".format(metas))
# get metadata devices, whose name property contains 'iPad'.
metas:XPRCollection = xsvc.GetMetadatas(True, "name", XPRFilterOperator.contains, "iPad")
print("** Metadatas (whose name contains 'iPad'):\n{0}\n".format(metas))
Returns configuration information for one or more MicrophoneGroups.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring. - parentId (str): Parent Group identifier to retrieve child group items of, or null to retrieve top level groups. Default is None.
Returns:
An XPRCollection class of XPRDeviceGroup items that contain device group configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get microphone device groups, both enabled and disabled.
grps:XPRCollection = xsvc.GetMicrophoneGroups(True)
print("** MicrophoneGroups (Enabled and Disabled):\n{0}\n".format(grps))
# get microphone device groups, enabled only.
grps:XPRCollection = xsvc.GetMicrophoneGroups(False)
print("** MicrophoneGroups (Enabled only):\n{0}\n".format(grps))
# get microphone device groups, whose displayName contains 'group'.
grps:XPRCollection = xsvc.GetMicrophoneGroups(True, "displayName", XPRFilterOperator.contains, "group")
print("** MicrophoneGroups (whose displayName contains 'group'):\n{0}\n".format(grps))
# get microphone device groups, whose name contains 'group'.
grps:XPRCollection = xsvc.GetMicrophoneGroups(True, "name", XPRFilterOperator.contains, "group")
print("** MicrophoneGroups (whose name contains 'group'):\n{0}\n".format(grps))
# get microphone device child groups for a designated parent group id.
grps:XPRCollection = xsvc.GetMicrophoneGroups(parentId="1ad9dc76-2a40-44f3-9cb3-bfa7236e80e6")
print("** MicrophoneGroups (child groups of parent group id):\n{0}\n".format(grps))
Returns configuration information for one or more Microphone devices.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring.
Returns:
An XPRCollection class of XPRMicrophone items that contain microphone configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get microphone devices, both enabled and disabled.
mics:XPRCollection = xsvc.GetMicrophones(True)
print("** Microphones (Enabled and Disabled):\n{0}\n".format(mics))
# get microphone devices, enabled only.
mics:XPRCollection = xsvc.GetMicrophones(False)
print("** Microphones (Enabled only):\n{0}\n".format(mics))
# sort results by name, descending.
mics.sort(reverse=True)
print("** Microphones (Collection Sorted by: Name, descending):\n{0}\n".format(mics))
# sort results by description, ascending.
mics.sort(key=lambda x: x.Description or "")
print("** Microphones (Collection Sorted by: Description, ascending):\n{0}\n".format(mics))
# get microphone devices, whose displayName property contains 'Office'.
mics:XPRCollection = xsvc.GetMicrophones(True, "displayName", XPRFilterOperator.contains, "Office")
print("** Microphones (whose displayName contains 'Office'):\n{0}\n".format(mics))
# get microphone devices, whose name property contains 'iPad'.
mics:XPRCollection = xsvc.GetMicrophones(True, "name", XPRFilterOperator.contains, "iPad")
print("** Microphones (whose name contains 'iPad'):\n{0}\n".format(mics))
Returns configuration information for one or more OutputGroups.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring. - parentId (str): Parent Group identifier to retrieve child group items of, or null to retrieve top level groups. Default is None.
Returns:
An XPRCollection class of XPRDeviceGroup items that contain device group configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get output device groups, both enabled and disabled.
grps:XPRCollection = xsvc.GetOutputGroups(True)
print("** OutputGroups (Enabled and Disabled):\n{0}\n".format(grps))
# get output device groups, enabled only.
grps:XPRCollection = xsvc.GetOutputGroups(False)
print("** OutputGroups (Enabled only):\n{0}\n".format(grps))
# get output device groups, whose displayName contains 'group'.
grps:XPRCollection = xsvc.GetOutputGroups(True, "displayName", XPRFilterOperator.contains, "group")
print("** OutputGroups (whose displayName contains 'group'):\n{0}\n".format(grps))
# get output device groups, whose name contains 'group'.
grps:XPRCollection = xsvc.GetOutputGroups(True, "name", XPRFilterOperator.contains, "group")
print("** OutputGroups (whose name contains 'group'):\n{0}\n".format(grps))
# get output device child groups for a designated parent group id.
grps:XPRCollection = xsvc.GetOutputGroups(parentId="bab66f49-aa6d-472b-afd8-be5f9a649bfc")
print("** OutputGroups (child groups of parent group id):\n{0}\n".format(grps))
Returns configuration information for one or more Output devices.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring.
Returns:
An XPRCollection class of XPROutput items that contain output configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get output devices, both enabled and disabled.
outs:XPRCollection = xsvc.GetOutputs(True)
print("** Outputs (Enabled and Disabled):\n{0}\n".format(outs))
# get output devices, enabled only.
outs:XPRCollection = xsvc.GetOutputs(False)
print("** Outputs (Enabled only):\n{0}\n".format(outs))
# sort results by name, descending.
outs.sort(reverse=True)
print("** Outputs (Collection Sorted by: Name, descending):\n{0}\n".format(outs))
# sort results by description, ascending.
outs.sort(key=lambda x: x.Description or "")
print("** Outputs (Collection Sorted by: Description, ascending):\n{0}\n".format(outs))
# get output devices, whose displayName property contains 'Office'.
outs:XPRCollection = xsvc.GetOutputs(True, "displayName", XPRFilterOperator.contains, "Office")
print("** Outputs (whose displayName contains 'Office'):\n{0}\n".format(outs))
# get output devices, whose name property contains 'iPad'.
outs:XPRCollection = xsvc.GetOutputs(True, "name", XPRFilterOperator.contains, "iPad")
print("** Outputs (whose name contains 'iPad'):\n{0}\n".format(outs))
Parses a JSON response dictionary for the parent key name, type name, and id value.
Arguments:
- oDict (dict): A dictionary object that represents the JSON response.
- parentTypeName (str): The parent key name that contains a type and id sub-key (e.g. "recordingStorage", etc).
- typeName (str): The type name that contains an id value (e.g. "storages", etc).
- serviceMethodName (str): Name of the service method that was called.
Example: "GetCameras", etc.
Returns:
The parent type id value if present; otherwise, None.
This can be used for any methods that return a type id within a "parent" response.
Returns configuration information for one or more Recording Servers.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring.
Returns:
An XPRCollection class of XPRRecordingServer items that contain recording server configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get recording servers, both enabled and disabled.
recsrvs:XPRCollection = xsvc.GetRecordingServers(True)
print("** RecordingServers (Enabled and Disabled):\n{0}\n".format(recsrvs))
# get recording servers, enabled only.
recsrvs:XPRCollection = xsvc.GetRecordingServers(False)
print("** RecordingServers (Enabled only):\n{0}\n".format(recsrvs))
# get recording servers, whose displayName contains 'WIN10VM'.
recsrvs:XPRCollection = xsvc.GetRecordingServers(True, "displayName", XPRFilterOperator.contains, "WIN10VM")
print("** RecordingServers (whose displayName contains 'WIN10VM'):\n{0}\n".format(recsrvs))
# get recording servers, whose name contains 'WIN10'.
recsrvs:XPRCollection = xsvc.GetRecordingServers(True, "name", XPRFilterOperator.contains, "WIN10")
print("** RecordingServers (whose name contains 'WIN10'):\n{0}\n".format(recsrvs))
Parses a JSON response dictionary for the related key name, type name, and id value.
Arguments:
- oDict (dict): A dictionary object that represents the JSON response.
- relationKeyName (str): The relation key name that contains a type and id sub-key (e.g. "parent", "self", etc).
- typeName (str): The type name that contains an id value (e.g. "hardware", "cameras", etc).
- serviceMethodName (str): Name of the service method that was called.
Example: "GetCameras", etc.
Returns:
The related type id value if present; otherwise, None.
This can be used for any methods that return a type id within a "relations" response.
For example:
"relations": { "parent": { "type": "hardware", "id": "08cf6a24-c7ab-4b50-80e0-5a56cf624c5f" }, }
Parses a JSON response dictionary for the related parent hardware type id value.
Arguments:
- oDict (dict): A dictionary object that represents the JSON response.
- serviceMethodName (str): Name of the service method that was called.
Example: "GetCameras", etc.
Returns:
The related parent hardware type id value if present; otherwise, None.
This can be used for any methods that return a hardware id within a "relations" response.
Returns site owner information for the specified site id.
Arguments:
- siteId (str): Site identifier to retrieve ownership information for. This can be a main site id, or
a child site id.
Default is None, which will retrieve ownership information for the main site.
Returns:
An XPRSiteOwner class that contains Site ownership details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any reason.
Sample Code
# package imports.
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
from milestonexprotectrestpython.xprsiteowner import XPRSiteOwner
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get site owner.
owner:XPRSiteOwner = xsvc.GetSiteOwner()
print("** Site Owner:\n{0}\n".format(owner))
owner:XPRSiteOwner = xsvc.GetSiteOwner("fc9e48ce-a39b-4327-8b92-32b012688944")
print("** Site Owner (by id, Management Server):\n{0}\n".format(owner))
owner:XPRSiteOwner = xsvc.GetSiteOwner("19f94d50-b5ad-4e90-8b3f-9928bb60f9f2")
print("** Site Owner (by id, Recording Server):\n{0}\n".format(owner))
Returns configuration information for one or more Sites.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring.
Returns:
An XPRCollection class of XPRSite items that contain site configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get sites, both enabled and disabled.
sites:XPRCollection = xsvc.GetSites(True)
print("** Sites (Enabled and Disabled):\n{0}\n".format(sites))
# get sites, enabled only.
sites:XPRCollection = xsvc.GetSites(False)
print("** Sites (Enabled only):\n{0}\n".format(sites))
# get sites, whose displayName contains 'WIN10VM'.
sites:XPRCollection = xsvc.GetSites(True, "displayName", XPRFilterOperator.contains, "WIN10VM")
print("** Sites (whose displayName contains 'WIN10VM'):\n{0}\n".format(sites))
# get sites, whose name contains 'WIN10'.
sites:XPRCollection = xsvc.GetSites(True, "name", XPRFilterOperator.contains, "WIN10")
print("** Sites (whose name contains 'WIN10'):\n{0}\n".format(sites))
Returns configuration information for one or more SpeakerGroups.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring. - parentId (str): Parent Group identifier to retrieve child group items of, or null to retrieve top level groups. Default is None.
Returns:
An XPRCollection class of XPRDeviceGroup items that contain device group configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get speaker device groups, both enabled and disabled.
grps:XPRCollection = xsvc.GetSpeakerGroups(True)
print("** SpeakerGroups (Enabled and Disabled):\n{0}\n".format(grps))
# get speaker device groups, enabled only.
grps:XPRCollection = xsvc.GetSpeakerGroups(False)
print("** SpeakerGroups (Enabled only):\n{0}\n".format(grps))
# get speaker device groups, whose displayName contains 'indoor'.
grps:XPRCollection = xsvc.GetSpeakerGroups(True, "displayName", XPRFilterOperator.contains, "indoor")
print("** SpeakerGroups (whose displayName contains 'indoor'):\n{0}\n".format(grps))
# get speaker device groups, whose name contains 'indoor'.
grps:XPRCollection = xsvc.GetSpeakerGroups(True, "name", XPRFilterOperator.contains, "indoor")
print("** SpeakerGroups (whose name contains 'indoor'):\n{0}\n".format(grps))
# get speaker device child groups for a designated parent group id.
grps:XPRCollection = xsvc.GetSpeakerGroups(parentId="4325fb90-ad75-4a03-b512-87a11f42b6e0")
print("** SpeakerGroups (child groups of parent group id):\n{0}\n".format(grps))
Returns configuration information for one or more Speaker devices.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring.
Returns:
An XPRCollection class of XPRSpeaker items that contain speaker configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get speaker devices, both enabled and disabled.
spkrs:XPRCollection = xsvc.GetSpeakers(True)
print("** Speakers (Enabled and Disabled):\n{0}\n".format(spkrs))
# get speaker devices, enabled only.
spkrs:XPRCollection = xsvc.GetSpeakers(False)
print("** Speakers (Enabled only):\n{0}\n".format(spkrs))
# sort results by name, descending.
spkrs.sort(reverse=True)
print("** Speakers (Collection Sorted by: Name, descending):\n{0}\n".format(spkrs))
# sort results by description, ascending.
spkrs.sort(key=lambda x: x.Description or "")
print("** Speakers (Collection Sorted by: Description, ascending):\n{0}\n".format(spkrs))
# get speaker devices, whose displayName property contains 'Office'.
spkrs:XPRCollection = xsvc.GetSpeakers(True, "displayName", XPRFilterOperator.contains, "Office")
print("** Speakers (whose displayName contains 'Office'):\n{0}\n".format(spkrs))
# get speaker devices, whose name property contains 'iPad'.
spkrs:XPRCollection = xsvc.GetSpeakers(True, "name", XPRFilterOperator.contains, "iPad")
print("** Speakers (whose name contains 'iPad'):\n{0}\n".format(spkrs))
Returns configuration information for one or more StateGroup items.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring.
Returns:
An XPRCollection class of XPRStateGroup items that contain StateGroup configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any other reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get StateGroups, both enabled and disabled.
grps:XPRCollection = xsvc.GetStateGroups(True)
print("** StateGroups (Enabled and Disabled):\n{0}\n".format(grps))
# get StateGroups, enabled only.
grps:XPRCollection = xsvc.GetStateGroups(False)
print("** StateGroups (Enabled only):\n{0}\n".format(grps))
# get StateGroups, whose displayName contains 'disk'.
grps:XPRCollection = xsvc.GetStateGroups(True, "displayName", XPRFilterOperator.contains, "disk")
print("** StateGroups (whose displayName contains 'disk'):\n{0}\n".format(grps))
# get StateGroups, whose name contains 'disk'.
grps:XPRCollection = xsvc.GetStateGroups(True, "name", XPRFilterOperator.contains, "disk")
print("** StateGroups (whose name contains 'disk'):\n{0}\n".format(grps))
Returns configuration information for one or more UserDefinedEvent items.
Arguments:
- includeDisabled (bool): True to include disabled items in the returned information;
otherwise False to return only enabled items.
Default is True. - filterName (str): Used to filter data returned using a property name (e.g. "name", "description", etc).
The value will be url-encoded, as it is used as part of a querystring. Default value is None. - filterOperator (str): Type of filtering to perform (e.g. contains, equals, lt, etc).
- filterValue (str): Value to search for if filtering returned data (e.g. "MyName", "MyDescription", etc).
The value will be url-encoded, as it is used as part of a querystring.
Returns:
An XPRCollection class of XPRUserDefinedEvent items that contain UserDefinedEvent configuration details.
Raises:
- XPRRestServiceException: The XProtect REST Server returned a failed response.
- XPRException: The method fails for any other reason.
If any of the filter arguments (filterName, filterOperator, filterValue) are specified, then ALL of the filter arguments are required. A filter will not be applied if ANY of the filter arguments are missing.
Sample Code
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService
# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get user-defined events, both enabled and disabled.
grps:XPRCollection = xsvc.GetUserDefinedEvents(True)
print("** UserDefinedEvents (Enabled and Disabled):\n{0}\n".format(grps))
# get user-defined events, enabled only.
grps:XPRCollection = xsvc.GetUserDefinedEvents(False)
print("** UserDefinedEvents (Enabled only):\n{0}\n".format(grps))
# get user-defined events, whose displayName contains 'audio'.
grps:XPRCollection = xsvc.GetUserDefinedEvents(True, "displayName", XPRFilterOperator.contains, "audio")
print("** UserDefinedEvents (whose displayName contains 'audio'):\n{0}\n".format(grps))
# get user-defined events, whose name contains 'recording'.
grps:XPRCollection = xsvc.GetUserDefinedEvents(True, "name", XPRFilterOperator.contains, "recording")
print("** UserDefinedEvents (whose name contains 'recording'):\n{0}\n".format(grps))