Skip to content

Latest commit

 

History

History
196 lines (125 loc) · 42.9 KB

File metadata and controls

196 lines (125 loc) · 42.9 KB

Views

Overview

Operations involving views

Available Operations

list_video_views

Retrieves a list of video views that fall within the specified filters and have been completed within a defined timespan. It lets you to analyse viewer interactions with your video content effectively.

How it works

  1. Send a GET request to this endpoint with the desired query parameters.

  2. Specify the timespan for which you want to retrieve the video views using the timespan[] parameter.

  3. Filter the views based on dimensions such as browser, device, video title, viewer ID, etc., using the filterby[] parameter. Get the dimensions by calling list the dimensions endpoint.

  4. Paginate the results using the limit and offset parameters.

  5. You can also filter by viewerId, errorCode, orderBy a specific field, and sortOrder in ascending or descending order.

  6. You receive a response containing the list of video views matching the specified criteria.

Each view in the response includes a unique viewId. You can use this viewId with the Get Video View Details endpoint to retrieve more detailed information about that specific view.

Example

If you manage a video streaming service and want to analyze content performance across devices and browsers. By calling the List Video Views endpoint with filters such as browser_name and device_type, you can identify which platforms are most popular with your audience. This information helps optimize content for widely used platforms and troubleshoot playback issues on less common devices.

Related guide: Audience metrics, Views dashboard

Example Usage

import os
import json

from fastpix_python import Fastpix, models

with Fastpix(
    security=models.Security(
        username="your-access-token",
        password="your-secret-key",
    ),
) as fastpix:

    res = fastpix.views.list_video_views(timespan="24:hours", filterby="browser_name:Chrome", limit=10, offset=1, viewer_id="your-viewer-id", error_code="1002", order_by="view_end", sort_order="asc")

    # Handle response
    print(json.dumps(res.model_dump(mode="json", by_alias=True, exclude_unset=True), indent=2))

Parameters

Parameter Type Required Description Example
timespan Optional[models.ListVideoViewsTimespan] ➖ This parameter specifies the time span between which the video views list must be retrieved by. You can provide either from and to unix epoch timestamps or time duration. The scope of duration is between 60 minutes to 30 days.

Accepted formats are:

array of epoch timestamps for example
timespan[]=1498867200&timespan[]=1498953600

duration string for example
timespan[]=24:hours or timespan[]=7:days
24:hours
filterby Optional[str] ➖ Pass the dimensions and their corresponding values you want to filter the views by. For excluding the values in the filter we can pass "!" before the filter value. The list of filters can be obtained from list of dimensions endpoint.
Example Values : [ browser_name:Chrome , os_name:macOS , !device_name:Galaxy ]
browser_name:Chrome
limit Optional[int] ➖ Pass the limit to display only the rows specified by the value.
10
offset Optional[int] ➖ Pass the offset value to indicate the page number.
1
viewer_id Optional[str] ➖ Pass the viewer_id to filter the list of views. This value can be manually set during integration or generated by FastPix. When set manually it can be a string of aplha numeric values of any length.
your-viewer-id
error_code OptionalNullable[str] ➖ Pass the error code to filter the list of views. The possible values of error code can be fetched from list of errors end point.
1002
order_by Optional[str] ➖ Pass this value to sort the view list by.
view_end
sort_order Optional[str] ➖ The order direction to sort the view list by.
asc
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.ListVideoViewsResponse

Errors

Error Type Status Code Content Type
errors.FastpixDefaultError 4XX, 5XX */*

get_video_view_details

Retrieves detailed information about a specific video view using its unique viewId. This provides insights into individual viewer interactions with your video content, helping you enhance user experience and improve engagement with your videos.

To use this endpoint, send GET request with the viewId. The response includes detailed metrics and attributes related to the specified video view.

Example

If a developer receives a report of a poor viewing experience for a specific user. By using this endpoint with the users viewId, the developer can retrieve metrics like buffering duration, playback errors, and session length. This data allows the developer to pinpoint issues (such as poor connectivity or a browser-specific problem) and take steps to improve the user experience.

Related guide: What Video Data do we capture?

Example Usage

import os
import json

from fastpix_python import Fastpix, models

with Fastpix(
    security=models.Security(
        username="your-access-token",
        password="your-secret-key",
    ),
) as fastpix:

    res = fastpix.views.get_video_view_details(view_id="<id>")

    # Handle response
    print(json.dumps(res.model_dump(mode="json", by_alias=True, exclude_unset=True), indent=2))

Parameters

Parameter Type Required Description
view_id str ✔️ Pass View Id
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.GetVideoViewDetailsResponse

Errors

Error Type Status Code Content Type
errors.FastpixDefaultError 4XX, 5XX */*

list_by_top_content

Retrieves a list of the top video views that fall within the specified filters and have been completed within a defined timespan. It lets you to identify the most popular content based on viewer interactions.

How it works

  1. Send a GET request to this endpoint with the desired query parameters.

  2. Specify the timespan for which you want to retrieve the top content using the timespan[] parameter.

  3. Filter the views based on dimensions such as browser, device, video title, etc., using the filterby[] parameter.

  4. You can use Limit to control number of top views returned.

  5. You receive a response containing the list of top video views matching the specified criteria.

Related guide: Get top-performing content

Example Usage

import os
import json

from fastpix_python import Fastpix, models

with Fastpix(
    security=models.Security(
        username="your-access-token",
        password="your-secret-key",
    ),
) as fastpix:

    res = fastpix.views.list_by_top_content(timespan="24:hours", filterby="browser_name:Chrome", limit=10)

    # Handle response
    print(json.dumps(res.model_dump(mode="json", by_alias=True, exclude_unset=True), indent=2))

Parameters

Parameter Type Required Description Example
timespan Optional[models.ListByTopContentTimespan] ➖ This parameter specifies the time span between which the video views list must be retrieved by. You can provide either from and to unix epoch timestamps or time duration. The scope of duration is between 60 minutes to 30 days.

Accepted formats are:

array of epoch timestamps for example
timespan[]=1498867200&timespan[]=1498953600

duration string for example
timespan[]=24:hours or timespan[]=7:days
24:hours
filterby Optional[str] ➖ Pass the dimensions and their corresponding values you want to filter the views by. For excluding the values in the filter we can pass "!" before the filter value. The list of filters can be obtained from list of dimensions endpoint.
Example Values : [ browser_name:Chrome , os_name:macOS , !device_name:Galaxy ]
browser_name:Chrome
limit Optional[int] ➖ Pass the limit to display only the rows specified by the value.
10
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.ListByTopContentResponse

Errors

Error Type Status Code Content Type
errors.FastpixDefaultError 4XX, 5XX */*