Contents
On this page

Import from TMDB - Plugixa Stream

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

Create a draft title from TMDB with its details, artwork and cast, or refresh chosen fields of an existing title. A movie’s runtime goes on its video, made as a draft when there is none.

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/import

Request body

Content type: application/json

Field Type Required Description
kind string Yes movie or tv.
id integer Yes The TMDB id.
series_id integer No An existing title to refresh. 0 or missing creates a new draft with every field.
fields string[] No When refreshing: which fields to bring in, from title, synopsis, year, genres, age_rating, original_lang, studios, release_status, trailer, poster, banner, cast.

An existing title keeps its kind. Artwork comes last: a failed download does not lose the rest.

{
  "kind": "movie",
  "id": 45745,
  "series_id": 2681,
  "fields": ["poster", "banner", "cast"]
}

Responses

201 Created.

{
  "success": true,
  "data": {
    "series_id": 2681
  }
}
Field Type Meaning
data.series_id integer The new or refreshed title

Errors

Status Code When
401 / 403 plugixa_stream_forbidden The caller lacks one of the three capabilities.
422 plugixa_stream_invalid kind or id is missing or invalid.
404 plugixa_stream_not_found TMDB has nothing with that id, or series_id is not a title.
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/import" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"kind":"movie","id":45745,"series_id":2681,"fields":["poster","banner","cast"]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-stream/v1/admin/tmdb/import');
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([
        'kind'      => 'movie',
        'id'        => 45745,
        'series_id' => 2681,
        'fields'    => ['poster', 'banner', 'cast'],
    ]),
]);
$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/import', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ kind: 'movie', id: 45745, series_id: 2681, fields: ['poster', 'banner', 'cast'] }),
});
const { data } = await response.json();

Quick Links

Share