Skip to content

Latest commit

 

History

History
307 lines (214 loc) · 21.5 KB

File metadata and controls

307 lines (214 loc) · 21.5 KB

Views

Overview

Operations involving views

Available Operations

list

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 { Fastpix } from "@fastpix/fastpix-node";

const fastpix = new Fastpix({
  security: {
    username: "your-access-token",
    password: "your-secret-key",
  },
});

async function run() {
  const result = await fastpix.views.list({
    timespan: "24:hours",
    filterby: "browser_name:Chrome",
    viewerId: "your-viewer-id",
    errorCode: "1002",
  });

  console.log(JSON.stringify(result, null, 2));
}

run();

Standalone function

The standalone function version of this method:

import { FastpixCore } from "@fastpix/fastpix-node/core.js";
import { viewsList } from "@fastpix/fastpix-node/funcs/viewsList.js";

// Use `FastpixCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const fastpix = new FastpixCore({
  security: {
    username: "your-access-token",
    password: "your-secret-key",
  },
});

async function run() {
  const res = await viewsList(fastpix, {
    timespan: "24:hours",
    filterby: "browser_name:Chrome",
    viewerId: "your-viewer-id",
    errorCode: "1002",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(JSON.stringify(result, null, 2));
  } else {
    console.log("viewsList failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.ListVideoViewsRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.ListVideoViewsResponse>

Errors

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

getDetails

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 { Fastpix } from "@fastpix/fastpix-node";

const fastpix = new Fastpix({
  security: {
    username: "your-access-token",
    password: "your-secret-key",
  },
});

async function run() {
  const result = await fastpix.views.getDetails({
    viewId: "your-view-id",
  });

  console.log(JSON.stringify(result, null, 2));
}

run();

Standalone function

The standalone function version of this method:

import { FastpixCore } from "@fastpix/fastpix-node/core.js";
import { viewsGetDetails } from "@fastpix/fastpix-node/funcs/viewsGetDetails.js";

// Use `FastpixCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const fastpix = new FastpixCore({
  security: {
    username: "your-access-token",
    password: "your-secret-key",
  },
});

async function run() {
  const res = await viewsGetDetails(fastpix, {
    viewId: "your-view-id",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(JSON.stringify(result, null, 2));
  } else {
    console.log("viewsGetDetails failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetVideoViewDetailsRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GetVideoViewDetailsResponse>

Errors

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

listTopContent

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 { Fastpix } from "@fastpix/fastpix-node";

const fastpix = new Fastpix({
  security: {
    username: "your-access-token",
    password: "your-secret-key",
  },
});

async function run() {
  const result = await fastpix.views.listTopContent({
    timespan: "24:hours",
    filterby: "browser_name:Chrome",
  });

  console.log(JSON.stringify(result, null, 2));
}

run();

Standalone function

The standalone function version of this method:

import { FastpixCore } from "@fastpix/fastpix-node/core.js";
import { viewsListTopContent } from "@fastpix/fastpix-node/funcs/viewsListTopContent.js";

// Use `FastpixCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const fastpix = new FastpixCore({
  security: {
    username: "your-access-token",
    password: "your-secret-key",
  },
});

async function run() {
  const res = await viewsListTopContent(fastpix, {
    timespan: "24:hours",
    filterby: "browser_name:Chrome",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(JSON.stringify(result, null, 2));
  } else {
    console.log("viewsListTopContent failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.ListByTopContentRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.ListByTopContentResponse>

Errors

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