Contents
On this page

Import TMDB Season - Plugixa Stream

POST /plugixa-stream/v1/admin/tmdb/season

Add a season’s episodes to a series imported from a TMDB show, as drafts with their titles, synopses and runtimes. Episodes imported before are updated, not doubled.

Needs a user with the plugixa_stream_create and plugixa_stream_edit capabilities and WordPress’s upload_files (signed in with an Application Password or the login cookie).

Request

POST https://your-site.example/wp-json/plugixa-stream/v1/admin/tmdb/season

Request body

Content type: application/json

Field Type Required Description
series_id integer Yes A title linked to a TMDB show by Import from TMDB.
season integer Yes The season number.
images boolean No Also download each episode’s still as its thumbnail, when it has none.
{
  "series_id": 2814,
  "season": 1,
  "images": true
}

Responses

200 OK.

{
  "success": true,
  "data": {
    "created": 13,
    "updated": 0
  }
}
Field Type Meaning
data.created integer New episodes
data.updated integer Episodes imported before and refreshed

Errors

Status Code When
401 / 403 plugixa_stream_forbidden The caller lacks one of the three capabilities.
422 plugixa_stream_tmdb The title is not linked to a TMDB show.
404 plugixa_stream_not_found TMDB has no such season.
422 plugixa_stream_tmdb_key No TMDB key is saved, or TMDB refused it.
502 plugixa_stream_tmdb TMDB could not be reached or answered oddly.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-stream/v1/admin/tmdb/season" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"series_id":2814,"season":1,"images":true}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-stream/v1/admin/tmdb/season');
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([
        'series_id' => 2814,
        'season'    => 1,
        'images'    => true,
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-stream/v1/admin/tmdb/season', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ series_id: 2814, season: 1, images: true }),
});
const { data } = await response.json();

Quick Links

Share