Contents
On this page

Add Favorite - Plugixa Video

POST /pvx/v1/videos/{id}/favorite

Save a video to the caller’s favorites. Saving it twice is not an error.

Any signed-in user (signed in with an Application Password or the login cookie). Signed out, it answers 401. Needs the Viewer library app on in Plugixa Video -> App manager; with it off, this route answers 404.

Note. A video the caller cannot watch yet, such as a paid one, can still be saved: favorites double as a wish list.

Request

POST https://your-site.example/wp-json/pvx/v1/videos/838/favorite

Path parameters

Name Type Description
id integer The video’s id

Responses

200 OK.

{
  "success": true,
  "data": {
    "favorite": true
  }
}
Field Type Meaning
data.favorite boolean true

Errors

Status Code When
401 plugixa_video_login_required Signed out.
404 plugixa_video_not_found No video with that id, or a draft, pending or private video the caller may not edit.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/pvx/v1/videos/838/favorite" \
  -u "$WP_USER:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/pvx/v1/videos/838/favorite');
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/favorite', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
  },
});
const { data } = await response.json();

Quick Links

Share