Contents
On this page

Update Settings - Plugixa Stream

PUT /plugixa-stream/v1/admin/settings

Change settings. Send only the keys that change: they are merged into what is stored, then each module cleans the keys it owns. POST works the same way.

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. Changing delete_data_on_uninstall also needs manage_options, a site administrator.

Request

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

Request body

Content type: application/json

Field Type Required Description
<key> mixed No Any setting key from Get Settings. Values out of range are clamped or reset by the owning module.
{
  "free_episodes": 3,
  "watermark": true
}

Responses

200 OK. data.settings is what was stored.

{
  "success": true,
  "data": {
    "settings": {
      "delete_data_on_uninstall": false,
      "free_episodes": 3,
      "provider": "self_hosted",
      "watermark": true
    }
  }
}
Field Type Meaning
data.settings object Every setting as stored. There is no choices here

Keys that no installed module claims are kept as they were, so a site that drops from Pro to free keeps its Pro settings.

Errors

Status Code When
401 / 403 plugixa_stream_forbidden The caller lacks the capability.
401 / 403 plugixa_stream_forbidden The request changes delete_data_on_uninstall and the caller is not a site administrator.

Plus the errors every endpoint can return.

Examples

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

Quick Links

Share