Contents
On this page

Reorder Playlist - Plugixa Video

PUT /pvx/v1/playlists/{id}/items

Put a playlist’s videos in a new order.

Needs a user (signed in with an Application Password or the login cookie) who manages the playlist: its owner, or a user who may edit other people’s videos (editors and administrators). Needs the Playlists app on in Plugixa Video -> App manager; with it off, this route answers 404.

Request

PUT https://your-site.example/wp-json/pvx/v1/playlists/1550/items

Path parameters

Name Type Description
id integer The playlist’s id

Request body

Content type: application/json

Field Type Required Description
video_ids integer[] Yes The video ids in the order wanted.

Ids that are not in the playlist are ignored, and videos you leave out keep their relative order after the ones you list. Nothing is added or removed.

{
  "video_ids": [840, 838]
}

Responses

200 OK. data lists the playlist’s videos in the new order.

{
  "success": true,
  "data": {
    "video_ids": [840, 838]
  }
}
Field Type Meaning
data.video_ids integer[] The playlist’s video ids in order, unpublished ones included

Errors

Status Code When
401 plugixa_video_login_required Signed out.
404 plugixa_video_not_found No playlist with that id, or a private playlist of someone else.
403 plugixa_video_forbidden The caller can see the playlist but does not manage it.
400 rest_missing_callback_param video_ids is missing.

Plus the errors every endpoint can return.

Examples

curl -s -X PUT "https://your-site.example/wp-json/pvx/v1/playlists/1550/items" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"video_ids":[840,838]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/pvx/v1/playlists/1550/items');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'PUT',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'video_ids' => [840, 838],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/pvx/v1/playlists/1550/items', {
  method: 'PUT',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ video_ids: [840, 838] }),
});
const { data } = await response.json();

Quick Links

Share