Contents
On this page
Mark Video as Watched - Plugixa Video
POST /pvx/v1/videos/{id}/watched
Mark a video as watched: the caller’s position is set to the end, and the video moves out of continue watching.
Any signed-in user (signed in with an Application Password or the login cookie). Signed out, it answers 401. The caller must be allowed to watch the video. Needs the Viewer library app on in Plugixa Video -> App manager; with it off, this route answers 404.
Note. An unknown id answers
403, not404.
Request
POST https://your-site.example/wp-json/pvx/v1/videos/838/watched
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The video’s id |
Responses
200 OK. data is the caller’s progress now.
{
"success": true,
"data": {
"position": 1460,
"duration": 1460,
"completed": true
}
}
| Field | Type | Meaning |
|---|---|---|
data.position |
integer |
Seconds: the video’s length, or 1 when its length is not known |
data.duration |
integer |
Seconds |
data.completed |
boolean |
true |
Errors
| Status | Code | When |
|---|---|---|
401 |
plugixa_video_login_required |
Signed out. |
403 |
plugixa_video_forbidden |
The caller may not watch this video, or there is no video with that id. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/pvx/v1/videos/838/watched" \
-u "$WP_USER:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/pvx/v1/videos/838/watched');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/pvx/v1/videos/838/watched', {
method: 'POST',
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
},
});
const { data } = await response.json();
Quick Links
Share