Analytics API - PhenixRTS Docs

Analytics API

APIs for generating analytics reports.

Generate a Concurrent Viewing Streams Report

This API generates a concurrent viewing streams report for the given interval.

In order to be able to generate reports, your account needs to be provisioned accordingly. Please contact your primary Phenix technical support contact if you wish to use analytics.

Request

Send a PUT request to pcast/streams/concurrent endpoint as shown:

curl https://pcast.phenixrts.com/pcast/streams/concurrent \
-u <applicationId>:<secret> \
-H "Accept: text/csv" \
-H "Content-Type: application/json" \
-X PUT \
-d '{
        "concurrentViewingStreamsReport": {
            "applicationIds": ["example.com"],
            "start": "2020-01-01T00:00:00Z",
            "end": "2020-01-02T00:00:00Z"
        }
    }'
--remote-name
--remote-header-name

Request Headers

Header Description
Authorization (required) Use HTTP Basic Authentication with your applicationId and secret

Request Fields

Field Description
concurrentViewingStreamsReport (required) See ConcurrentViewingStreamsReport object below

ConcurrentViewingStreamsReport Object

Field Description
applicationIds (optional) Array of applications IDs to report for. By default, it will report viewing streams for the Application ID from credentials.
streamIds (optional) Array of origin stream IDs to report for. Limits the report to viewing streams of just these origin streams.
channelIds (optional) Array of channel IDs to report for. Limits the report to just these channel IDs.
channelAliases (optional) Array of channel aliases to report for. Limits the report to just these channel aliases.
originTags (optional) Array of origin Tags to report for. Limits the report to viewing streams of only origin streams with these tags.
viewerTags (optional) Array of viewer Tags to report for. Limits the report to only viewing streams with these tags.
start (required) The report start time. Either an RFC3339 timestamp string or an integer of UNIX epoch time in milliseconds.
end (required) The report end time. Either an RFC3339 timestamp string or an integer of UNIX epoch time in milliseconds.

Note: All filter conditions are cumulative.

Response

The response is in CSV format.

Report Response Fields

Column Description
ApplicationId Application ID for which the number of concurrent viewing streams is counted
Timestamp The time at which the number of concurrent viewing streams is counted
Concurrent Number of concurrent viewing streams
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 85
Content-Disposition: attachment; filename="20200204T171148Z-START20200101T000000Z-END20200102T000000Z-ConcurrentViewingStreams-RWYkT1.csv"

ApplicationId,Timestamp,Concurrent
example.com,2020-01-01 20:16:38,200
example.com,2020-01-01 20:16:39,15
example.com,2020-01-01 20:16:40,2

If the request fails, the platform will return a failed response that contains a "status" field. The HTTP status code is set according to the "status" field.

HTTP/1.1 400 Bad request
Content-Type: application/json; charset=utf-8
Content-Length: 37

{"status":"excessive-report-interval"}

Concurrent Viewing Streams Report API Response Fields

Field Description
status See status codes below

Concurrent Viewing Streams Report API Status Codes

HTTP Status Retry Description
200 OK ok never Report was successfully created.
400 Bad Request varies never Indicates an issue with the request.
400 Bad Request excessive-report-interval never The interval for the report exceeds 1 day.
400 Bad Request period-start-outside-supported-window never The year of the start of the period is more than 1 year before the current year.
400 Bad Request period-end-must-be-in-past never The end of the period is in the future.
400 Bad Request period-end-must-be-after-start never The end of the period is less than or equal to the start of the period.
400 Bad Request unsupported never The parameter combination is not supported.
401 Unauthorized unauthorized never The streaming platform was not able to authorize the provided credentials.
4XX varies never Indicates an issue with the request.
503 Service Unavailable capacity once The system is temporarily overloaded. Please try again later.
5XX varies once immediately, then exponential backoff A transient server error.
Error Responses

Please be aware that some server errors 5XX and request validation errors 400 and 401 may result in an arbitrary response body not encoded in JSON.