Contents
On this page

Create Term - Plugixa Stream

POST /plugixa-stream/v1/admin/terms

Add a genre, tag, studio or language. A name that already exists in that taxonomy returns the existing term instead of a second one.

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

Request

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

Request body

Content type: application/json

Field Type Required Description
taxonomy string Yes genres, tags, studios or languages.
name string Yes Must not be blank.
{
  "taxonomy": "genres",
  "name": "Sci-Fi"
}

Responses

201 Created.

{
  "success": true,
  "data": {
    "id": 11,
    "name": "Sci-Fi"
  }
}
Field Type Meaning
data.id integer The term id, new or existing
data.name string The name

Errors

Status Code When
401 / 403 plugixa_stream_forbidden The caller lacks the capability.
422 plugixa_stream_invalid taxonomy is not one of the four, or name is blank.

Plus the errors every endpoint can return.

Examples

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

Quick Links

Share