Contents
On this page
REST API - Plugixa Video
This page is for developers. The plugin has one REST namespace, pvx/v1, used by its own
admin app, its player and its public pages. You can read the public routes from anywhere, call
the others from code on the same site, or add routes of your own.
Every route lives under:
https://example.com/wp-json/pvx/v1/
Who can call what
| Caller | How it is recognized | What it reaches |
|---|---|---|
| Anyone | Nothing: the routes are public | Published videos, channels, public playlists, categories and tags, and a video’s source when its access rules allow. With Pro, also series and related videos. |
| A signed-in viewer | The WordPress cookie and a REST nonce (X-WP-Nonce) |
Their library, favorites, likes, progress, subscriptions and own playlists. |
| A back-office user | The same cookie and nonce, plus the plugin’s capabilities | The admin app’s routes, as far as their role allows. |
There are no API keys: a request from outside the site is anonymous and reaches the public routes only. Back-office routes check the plugin’s capabilities and WordPress’s ownership rules, so a creator reaches their own videos only (see Creators and moderation PRO). A route of an app that is switched off in the App manager does not answer.
Answers
Every answer has the same shape. A list carries the totals in meta:
{
"success": true,
"data": [ { "id": 838, "title": "Iceland: The Ring Road", "channel": "Far Places" } ],
"meta": { "total": 100, "pages": 100 }
}
An error is a standard WordPress REST error with a code, a message and the HTTP status in
data.status, for example plugixa_video_forbidden or plugixa_video_not_found.
Public routes
| Route | What it answers |
|---|---|
GET /videos |
A page of published videos. |
GET /videos/{id} |
One video. Drafts and private videos answer 404 to the public. |
GET /videos/{id}/related PRO |
Suggested videos. limit from 1 to 24, default 12. |
GET /videos/{id}/source |
What the player plays, after the access check. |
GET /channels, GET /channels/{id} |
Published channels, or one. |
GET /series, GET /series/{id} PRO |
Published series, or one. Takes category. |
GET /playlists, GET /playlists/{id} |
Playlists. scope is public (default), featured or mine (signed in). |
GET /terms |
Categories (taxonomy=pvx_category, the default) or tags (taxonomy=pvx_tag). |
Lists take these query parameters:
| Parameter | Default | What it does |
|---|---|---|
page |
1 | The page to return. |
per_page |
20 | Records per page, at most 100. |
search |
Words to search for. | |
order |
desc |
asc or desc. |
GET /videos also takes access (free, members, paid), with Pro type (video,
movie, episode), duration (short under 4 minutes, medium 4 to 20, long over 20), orderby
(date, views, title), category, tag, channel, with Pro series, include[] (ids) and
upcoming (also list scheduled videos).
Examples
The latest five videos of the Far Places channel (channel id 692 on the demo site):
curl "https://example.com/wp-json/pvx/v1/videos?channel=692&per_page=5"
The most viewed movies (Pro):
curl "https://example.com/wp-json/pvx/v1/videos?type=movie&orderby=views"
All categories:
curl "https://example.com/wp-json/pvx/v1/terms?taxonomy=pvx_category"
What to watch after video 838 (Pro):
curl "https://example.com/wp-json/pvx/v1/videos/838/related?limit=6"
A video’s source
GET /videos/{id}/source answers with the type, title, poster, duration, chapters, subtitles
(with Pro) and a playable url. For uploaded and linked files the url is a signed link that expires after a
few minutes, so do not store it. The answer carries Cache-Control: no-store, private.
When the caller may not watch the video, the answer is an error with a short teaser (id, title,
poster, access) for the lock screen:
| Status | Code | Why |
|---|---|---|
| 401 | plugixa_video_login_required |
A members-only video, and nobody is signed in. |
| 403 | plugixa_video_locked |
Signed in, but this video is not included in their access. |
| 403 | plugixa_video_password_required |
The video has a password. |
| 404 | plugixa_video_not_found |
No such video, or a draft the caller may not see. |
Signed-in viewer routes
| Route | What it does |
|---|---|
GET /me/library |
Continue watching, history, favorites, subscriptions and playlists. |
GET /videos/{id}/me |
Whether this viewer favorited or liked the video, is subscribed to its channel, and which of their playlists hold it. |
POST, DELETE /videos/{id}/favorite |
Add or remove a favorite. |
POST, DELETE /videos/{id}/like |
Like or unlike. |
POST /videos/{id}/watched |
Mark as watched. |
GET, POST /videos/{id}/progress |
Read or save the position, in seconds. |
POST, DELETE /channels/{id}/subscribe |
Subscribe or unsubscribe. |
GET /feed |
New videos from the channels they follow. |
POST /playlists, then PUT or PATCH, DELETE /playlists/{id} |
Make and manage their own playlists. Items: POST /playlists/{id}/items, PUT to reorder, DELETE /playlists/{id}/items/{video_id}. |
With Pro, the player also sends POST /videos/{id}/stats for
Analytics PRO. It is open to anyone who may watch the video, and is not meant for other callers.
Back-office routes
These are what the admin app calls. They need a signed-in user with the right capability.
| Routes | Who |
|---|---|
POST /videos, PUT/PATCH/DELETE /videos/{id}, and the same for /channels (and /series with Pro) |
Users who may create, edit or delete, on records they may edit. Add context=edit to a list to include drafts, pending and private items. |
/videos/{id}/media, /uploads, /renditions, /poster, /poster-frame, /subtitles PRO |
Users who may edit that video. |
GET /analytics PRO |
Users who may edit videos. Creators get their own figures. |
GET, PUT /settings |
Read: any back-office user. Write: users who may manage settings; the uninstall switch needs a site administrator. |
/setup, /design/... |
Users who may manage settings. |
GET, POST /apps |
Site administrators (manage_options). |
With Pro PRO, more routes appear under
the same namespace: /checkout and /me/purchases, /me/memberships for signed-in buyers,
/me/notifications, the payment provider notices at /webhooks/stripe and /webhooks/paypal,
the series, related videos, uploads, subtitles and analytics routes above, and back-office
routes for orders, plans, earnings, import, custom fields, AI subtitles, audio tracks and
audience insights.
Adding your own routes
The plugixa_video_register_rest_routes action fires when the plugin registers its routes. It
passes the namespace and the plugin’s service container, so your routes sit beside the plugin’s:
add_action( 'plugixa_video_register_rest_routes', function ( string $namespace ) {
register_rest_route( $namespace, '/my-site/most-watched', array(
'methods' => 'GET',
'callback' => 'my_site_most_watched',
'permission_callback' => function () {
return current_user_can( 'plugixa_video_view' );
},
) );
} );
The plugin’s capabilities are plugixa_video_view, plugixa_video_create,
plugixa_video_edit, plugixa_video_delete and plugixa_video_manage_settings. For events you
can react to without a route, see Hooks.
Quick Links
Share