md-platform

LiveUniqueUsers.md
View raw Back to list

Live Unique Users — Frontend Integration

Returns the distinct logged-in users who watched a video while it was live, with their name/email when known. Paginated. Intended for the admin analytics dashboard.


Endpoint

GET /admin/v1/video-analytics/live-unique-users/{videoId}?page=1&pageSize=15

Path parameters

Name Type Description
videoId string The video id.

Query parameters

Name Type Default Notes
page number 1 1-based page number. Values <= 0 are treated as 1.
pageSize number 15 Items per page. Max 50 (larger values are clamped to 50; <= 0 becomes 1).

Response 200 OK

Standard pagination envelope ({ items, totalCount }):

{
  "items": [
    {
      "userId": "14a29c05-1983-4b14-ba98-a88202bd9493",
      "name": "Riad Asllani",
      "email": "[email protected]",
      "portaLink": null
    },
    {
      "userId": "2f59d36d-e479-40bc-bc29-e6e398c40bd3",
      "name": null,
      "email": null,
      "portaLink": "https://porta-gjirafainc-admin.gjirafa.com/users/2f59d36d-e479-40bc-bc29-e6e398c40bd3/user-details"
    }
  ],
  "totalCount": 30
}

Top-level fields

Field Type Notes
totalCount number Total distinct logged-in users who watched while live (the full count, not just this page). Use it to compute the number of pages: Math.ceil(totalCount / pageSize).
items array Users for the requested page only.

items[] fields

Field Type Notes
userId string The user's id (Porta/account id). Always present.
name string | null Full name. null when the user was not found in the internal users DB.
email string | null Email. null when not found internally.
portaLink string | null Set only when name/email are null. Link to look the user up manually in the Porta admin portal.

How the frontend should render a row

For each item in items:

items.map(u =>
  u.email
    ? <Row name={u.name} email={u.email} />
    : <Row id={u.userId} link={u.portaLink} label="View in Porta" />
)

// pages
const totalPages = Math.ceil(totalCount / pageSize);

Behavior notes


Examples

# first page (default page=1, pageSize=15)
curl -X GET "{BASE_URL}/admin/v1/video-analytics/live-unique-users/aZjMMPomjV" \
  -H "Authorization: <same admin auth as other admin analytics calls>"

# page 2, 25 per page
curl -X GET "{BASE_URL}/admin/v1/video-analytics/live-unique-users/aZjMMPomjV?page=2&pageSize=25" \
  -H "Authorization: <same admin auth as other admin analytics calls>"