Skip to content

AVideo Platform API

Daniel Neto edited this page Apr 8, 2025 · 16 revisions

🚀 Quick‑Start Checklist

  1. Enable the API plugin (Admin ➜ Plugins ➜ API ➜ Enable).
  2. Choose the endpoint style you prefer (legacy or simplified).
  3. Authenticate users (raw password, encoded password, or bearer token).
  4. Call the required endpoint (see the reference below).
  5. Handle the JSON response in your application.

1️⃣ Enabling the API Plugin

Make sure the API plugin is active on your server.

chrome-capture-2025-4-8


2️⃣ Endpoint Formats

Purpose Legacy Format Simplified Format (recommended)
Sign‑in /plugin/API/get.json.php?APIName=signIn&user=admin&pass=123 /api/signIn?user=admin&pass=123
Any API /plugin/API/get.json.php?APIName={name}&… /api/{name}?…

Tip: To migrate, simply replace …/plugin/API/get.json.php?APIName= with …/api/.


3️⃣ Authentication Methods

3.1 Raw Password

Send the plain password in the pass parameter.

3.2 Encoded Password

  1. Generate an MD5 hash:

    GET https://demo.avideo.com/objects/encryptPass.json.php?pass=123
  2. Use the hash in pass and add encodedPass=true.

3.3 Bearer Token

If you generated an API secret, send it in the header:

Authorization: Bearer YOUR_API_SECRET

4️⃣ Example Sign‑In Calls

# Raw password
GET https://demo.avideo.com/api/signIn?user=admin&pass=123

# Encoded password
GET https://demo.avideo.com/api/signIn?user=admin&pass=f321d14cdeeb7cded7489f504fa8862b&encodedPass=true

5️⃣ Reusable PHP Login Helper

<?php
/** Simple AVideo API login helper. */
session_start();
const API_BASE = 'https://demo.avideo.com/api/';

function signIn(string $user, string $pass): bool {
    $url = API_BASE . 'signIn?user=' . urlencode($user) . '&pass=' . urlencode($pass);
    $json = @file_get_contents($url);
    $data = json_decode($json, true);
    if (!empty($data['status']) && $data['status'] === '1') {
        $_SESSION['user'] = $data;
        return true;
    }
    return false;
}

function requireLogin(): void {
    if (empty($_SESSION['user'])) {
        header('Location: login.php');
        exit;
    }
}
?>

6️⃣ Uploading Videos

Use the Streamer API to upload videos from external systems.

Guide: https://github.com/WWBN/AVideo/wiki/Upload-videos-from-third-party-applications


7️⃣ Sample Video Query

GET https://demo.avideo.com/api/video?catName=default&rowCount=1
{
  "error": false,
  "response": {
    "rows": [
      {
        "id": 7618408,
        "title": "Live 24 hours",
        "channelName": "MovieclipsTrailers",
        "poster": "https://demo.avideo.com/plugin/Live/getImage.php?u=movieclips&format=jpg",
        "link": "https://demo.avideo.com/live/0/MovieclipsTrailers",
        "views_count": 0,
        "duration": "Live",
        "likes": 0,
        "dislikes": 0
      }
    ]
  }
}

8️⃣ Collecting Video & Ad Statistics

Track user engagement (watch time, last position, ad impressions, etc.) and push the data back via API.

Guide: https://github.com/WWBN/AVideo/wiki/Developer-Guide:-Collecting-Video-and-Ad-Play-Statistics


9️⃣ React Front‑End Sample

A ready‑to‑fork React + Tailwind + Vite project that consumes the AVideo API.

GitHub: https://github.com/WWBN/AVideo-React-Sample

Key features:

  • Video listing & playback
  • API‑based login/logout
  • Dark‑mode support & responsive UI

🔟 Viewing the OpenAPI 3.1 Specification

You must be logged in as an admin to view the live spec.
Demo credentials: user: admin  pass: 123

  1. Log in to the demo site: https://demo.avideo.com/
  2. Navigate to: https://demo.avideo.com/plugin/API/
  3. The page automatically loads the full OpenAPI 3.1 specification—endpoints, parameters, schemas, and example responses.

You can access the same documentation on any self‑hosted AVideo instance at:

https://YOUR‑DOMAIN/plugin/API/

1️⃣1️⃣ Common Endpoints (Cheat‑Sheet)

Endpoint Purpose
signIn Authenticate a user
signUp Create an account
video List videos
videoAddView Register a view
categories List categories
encryptPass MD5 hash generator
live List live streams
search Search videos & channels
user User profile data

Refer to the OpenAPI 3.1 spec for complete details.


1️⃣2️⃣ Additional Resources


🤝 Contributing

Pull requests and issues are welcome. If you spot an error or want to extend the API, open a ticket or PR on GitHub.


Authored & maintained by [Daniel Neto](https://github.com/DanielnetoDotCom)

Clone this wiki locally