Contents
On this page

Update Bunny Settings - Plugixa Stream

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

Save the Bunny Stream settings. A key left empty keeps the saved one. Keys are stored encrypted.

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/bunny/settings

Request body

Content type: application/json

Field Type Required Description
library_id string No Digits only; other characters are removed.
cdn_host string No Host name; a leading https:// is removed.
ttl integer No 60 to 86400 seconds.
api_key string No The library API key (not the account key).
token_key string No The token authentication key.
clear_api_key boolean No Remove the saved key. Also clear_token_key.
{
  "library_id": "123456",
  "cdn_host": "vz-1a2b3c4d-5e6.b-cdn.net",
  "ttl": 1800
}

Responses

200 OK. The settings as in Get Bunny Settings.

{
  "success": true,
  "data": {
    "library_id": "123456",
    "cdn_host": "vz-1a2b3c4d-5e6.b-cdn.net",
    "ttl": 1800,
    "has_api_key": true,
    "has_token_key": true
  }
}

Errors

Status Code When
401 / 403 plugixa_stream_forbidden The caller lacks the capability.

Plus the errors every endpoint can return.

Examples

curl -s -X PUT "https://your-site.example/wp-json/plugixa-stream/v1/admin/bunny/settings" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"library_id":"123456","cdn_host":"vz-1a2b3c4d-5e6.b-cdn.net","ttl":1800}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-stream/v1/admin/bunny/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([
        'library_id' => '123456',
        'cdn_host'   => 'vz-1a2b3c4d-5e6.b-cdn.net',
        'ttl'        => 1800,
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-stream/v1/admin/bunny/settings', {
  method: 'PUT',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ library_id: '123456', cdn_host: 'vz-1a2b3c4d-5e6.b-cdn.net', ttl: 1800 }),
});
const { data } = await response.json();

Quick Links

Share