Contents
On this page

Save Progress - Plugixa Stream

POST /plugixa-stream/v1/me/progress

Store where the caller is in one or more episodes. The player sends a batch every few seconds and when it closes; the Watch app also sends a guest’s browser progress here once they sign in.

Any signed-in user (an Application Password, or the login cookie with an X-WP-Nonce header). Signed out, it answers 401 plugixa_stream_login_required. It always acts on the caller’s own account.

Note. Only an episode the caller may play is saved; others in the batch are skipped without an error. An episode counts as finished when completed is sent or position reaches 92% of duration, and stays finished.

Request

POST https://your-site.example/wp-json/plugixa-stream/v1/me/progress

Request body

Content type: application/json

Field Type Required Description
items object[] Yes Up to 50 entries; more are ignored.
items[].episode_id integer Yes The episode.
items[].position integer No Seconds from the start. Defaults to 0.
items[].duration integer No The episode’s length in seconds, 0 if unknown. The longest value sent is kept.
items[].completed boolean No The player saw the end. Defaults to false.
{
  "items": [
    {
      "episode_id": 2815,
      "position": 1134,
      "duration": 1134,
      "completed": true
    },
    {
      "episode_id": 2816,
      "position": 312,
      "duration": 1147
    }
  ]
}

Responses

200 OK.

{
  "success": true,
  "data": {
    "saved": 2
  }
}
Field Type Meaning
data.saved integer How many entries were stored

With Pro profiles, progress is stored for the active profile of the login session. Requests signed with an Application Password always use the account’s own profile.

Errors

Status Code When
401 plugixa_stream_login_required Signed out.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-stream/v1/me/progress" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"items":[{"episode_id":2815,"position":1134,"duration":1134,"completed":true},{"episode_id":2816,"position":312,"duration":1147}]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-stream/v1/me/progress');
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([
        'items' => [
            [
                'episode_id' => 2815,
                'position'   => 1134,
                'duration'   => 1134,
                'completed'  => true,
            ],
            [
                'episode_id' => 2816,
                'position'   => 312,
                'duration'   => 1147,
            ],
        ],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-stream/v1/me/progress', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ items: [{ episode_id: 2815, position: 1134, duration: 1134, completed: true }, { episode_id: 2816, position: 312, duration: 1147 }] }),
});
const { data } = await response.json();

Quick Links

Share