The DRM Statistics API provides insights into DRM-protected playback activity across multiple DRM systems, including Widevine, FairPlay, and PlayReady. This API allows you to retrieve statistics on playback sessions, error rates, and key exchanges over a specified time range. The collected data helps monitor and optimize DRM performance across different platforms and devices.
Data for this API is saved by the system for a 48 hour sliding window. Requesting data beyond 48 hours in the past is not allowed.
Base URL
Use the following base URL:
https://services.uplynk.com/api/v4/monitoring/drm-events
Request Parameters
The following table details the required and optional parameters for making a request to the DRM Statistics API:
Parameter | Data Type | Description | Required |
---|---|---|---|
period | Integer | Aggregates the data over a defined time interval in seconds, simplifying analysis by grouping data points within consistent time windows. Accepted Values: 10, 20, 30, 40, 50, 60, 120 | Optional; default is None |
start | String | Indicates the date and time (UTC) at which the statistics start period should begin. Syntax: YYYY-MM-DDThh:mm:ss Example: 2025-02-12T15:53:00 | Either start or end is required. If only start is passed, the system will fill the end based on a 5-minute block. |
end | String | Indicates the date and time (UTC) at which the statistics start period should end. Syntax: YYYY-MM-DDThh:mm:ss Example: 2025-02-12T15:57:10 | Either start or end is required. If only end is passed, the system will fill the start based on a 5-minute block. |
force | Boolean | If data for a portion of the date range specified is not yet processed, force=false will return what is available. Otherwise, a 202 response will be returned with the current maximum timestamp available. | Optional; default isfalse |
Sample Request
import json
import requests
from api_auth import APICredentials, APIParams
class GetLatestDRMEvents:
def __init__(self):
self.host = "https://services.uplynk.com"
def run(self):
"""
Get the latest DRM event statistics.
"""
self._get_latest_drm_events()
def _get_latest_drm_events(self):
params = {
'period': 60,
'start': '2025-02-12T15:53:00',
'end': '2025-02-12T15:57:10',
'force': False,
}
url = f"{self.host}/api/v4/monitoring/drm-events"
response = requests.get(
url, params={**params, **APIParams(APICredentials()).get_params({})}
)
if response.status_code == 200:
print(json.dumps(response.json(), indent=2)) # Pretty print JSON response
else:
print("Error:", response.status_code)
print(response.json())
if __name__ == "__main__":
GetLatestDRMEvents().run()
Response Schema
The response returns statistics on DRM-protected playback sessions, error rates, and other relevant metrics.
Field | Data Type | Description |
---|---|---|
@id | String | The request URL with query parameters included. |
@type | String | The type of response, which is always TimeSeries . |
start | String | The start time of the requested statistics range in YYYY-MM-DDThh:mm:ss.SSSZ format. |
end | String | The end time of the requested statistics range in YYYY-MM-DDThh:mm:ss.SSSZ format. |
items | Array | List of DRM statistics objects. |
total_items | Integer | The total number of DRM statistics objects returned. |
search_version | Integer | Version number of the search operation. |
DRM Statistics Item Schema
Field | Data Type | Description |
---|---|---|
drm_type | String | The type of DRM used (widevine , fairplay , or playready ). |
num_success | Integer | The number of successfully granted DRM licenses. |
num_failures | Integer | The number of failed DRM license requests. |
success_ratio | Float | The ratio of successful requests to total requests. |
errors | String | Any errors encountered during DRM license requests. |
Sample Response
{
"@id": "/api/v4/monitoring/drm-events?start=2025-02-12T15:53:00&end=2025-02-12T15:57:10",
"@type": "TimeSeries",
"start": "2025-02-12T15:53:00.000Z",
"end": "2025-02-12T15:57:01.000Z",
"items": [
{
"period_timestamp": "2025-02-18T15:53:00+00:00",
"drm_type": "fairplay",
"num_success": 1069,
"num_failures": 0,
"success_ratio": 1,
"errors": ""
},
{
"period_timestamp": "2025-02-18T15:53:00+00:00",
"drm_type": "widevine",
"num_success": 1005,
"num_failures": 0,
"success_ratio": 1,
"errors": ""
},
{
"period_timestamp": "2025-02-18T15:53:00+00:00",
"drm_type": "playready",
"num_success": 2,
"num_failures": 0,
"success_ratio": 1,
"errors": ""
}
],
"total_items": 3,
"search_version": 3
}
This API enables efficient tracking of DRM-related statistics, helping you analyze and improve your DRM authentication flows across multiple DRM types.