Contents
On this page

Update TMDB Settings - Plugixa Stream

PUT /plugixa-stream/v1/admin/tmdb/settings

Save the TMDB settings. A new key is tried straight away with a search, so a typo shows here and not at the first import.

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

Request

PUT https://your-site.example/wp-json/plugixa-stream/v1/admin/tmdb/settings

Request body

Content type: application/json

Field Type Required Description
key string No TMDB API key. Empty keeps the saved one. Stored encrypted.
clear_key boolean No Remove the saved key.
language string No Such as en-US or fr; anything else becomes en-US.
region string No A two-letter country code.
{
  "key": "your-tmdb-api-key",
  "language": "en-US",
  "region": "US"
}

Responses

200 OK. The settings as in Get TMDB Settings.

{
  "success": true,
  "data": {
    "has_key": true,
    "language": "en-US",
    "region": "US"
  }
}

Errors

Status Code When
401 / 403 plugixa_stream_forbidden The caller lacks the capability.
422 plugixa_stream_tmdb_key TMDB refused the new key. When no key was saved before, the new one is removed again; when one was, the refused key replaces it all the same.

Plus the errors every endpoint can return.

Examples

curl -s -X PUT "https://your-site.example/wp-json/plugixa-stream/v1/admin/tmdb/settings" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"key":"your-tmdb-api-key","language":"en-US","region":"US"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-stream/v1/admin/tmdb/settings');
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([
        'key'      => 'your-tmdb-api-key',
        'language' => 'en-US',
        'region'   => 'US',
    ]),
]);
$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/settings', {
  method: 'PUT',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ key: 'your-tmdb-api-key', language: 'en-US', region: 'US' }),
});
const { data } = await response.json();

Quick Links

Share