Contents
On this page

Set Episode Access - Plugixa Stream

POST /plugixa-stream/v1/admin/episodes/access

Set how several episodes are priced at once, for example “make episodes 1 to 10 free”.

Needs a user with the plugixa_stream_edit capability (signed in with an Application Password or the login cookie). Administrators hold it; other roles only when you grant it.

Request

POST https://your-site.example/wp-json/plugixa-stream/v1/admin/episodes/access

Request body

Content type: application/json

Field Type Required Description
ids integer[] Yes Episode ids. Ids that are not episodes are skipped.
access string Yes auto, free or paid. Any other value changes nothing.
{
  "ids": [2815, 2816, 2817],
  "access": "free"
}

Responses

200 OK.

{
  "success": true,
  "data": {
    "changed": 3
  }
}
Field Type Meaning
data.changed integer Episodes changed. 0 when access was not valid

Errors

Status Code When
401 / 403 plugixa_stream_forbidden The caller lacks the capability.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-stream/v1/admin/episodes/access" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"ids":[2815,2816,2817],"access":"free"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-stream/v1/admin/episodes/access');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'ids'    => [2815, 2816, 2817],
        'access' => 'free',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-stream/v1/admin/episodes/access', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ ids: [2815, 2816, 2817], access: 'free' }),
});
const { data } = await response.json();

Quick Links

Share