Adding trailers via Plex API - no way for me & suspected permanent bug

rossinior
Sun, 30 Nov 2025 19:06:17 +0000
Dev/API Corner

Hi all,

I am currently checking out on Plex API and trying to maximize gains from using the API.

This time: Adding an extra (trailer) to a movie that already has a trailer (chosen by Plex).

According to documentation at https://developer.plex.tv/pms/ there’s a POST call to https://{IP-description}.{identifier}.plex.direct:{port}/library/metadata/{ids}/extras …. to add extras to a a Plex item (movie, for example).

I set up a library containing a single movie that gets a movie trailer automatically. The GET call to the movie id/extras is working. Next, I want to add an new extra of subtype trailer to that movie.

But the POST call always gets a 404 error. I know that there’s a 404 response if something’s not right, but no further info on why is shared. Tried a couple of ways to do it, but it always responds with 404.

I construct the POST call using node.js script which I am happy to supply.

Then I checked the PMS logs what happens and I see the following:

Nov 30, 2025 18:43:12.419 [140677436054328] Debug — Request: [192.168.94.150:53998 (Subnet)] POST /library/metadata/224322/extras?url=http%3A%2F%2Fcommondatastorage.googleapis.com%2Fgtv-videos-bucket%2Fsample%2FBigBuckBunny.mp4&title=Injection+%28Local%29&extraType=1 (10 live) #ac7f69 GZIP Signed-in Token (rossinior)
Nov 30, 2025 18:43:12.422 [140677436054328] Debug — [Req#ac7f69/HCl#263b3] HTTP requesting GET https://node.plexapp.com:32443/system/services/url/lookup?url=http%3A%2F%2Fcommondatastorage.googleapis.com%2Fgtv-videos-bucket%2Fsample%2FBigBuckBunny.mp4
Nov 30, 2025 18:43:12.422 [140678249032504] Warnung — [HttpClient/HCl#263b3] HTTP error requesting GET https://node.plexapp.com:32443/system/services/url/lookup?url=http%3A%2F%2Fcommondatastorage.googleapis.com%2Fgtv-videos-bucket%2Fsample%2FBigBuckBunny.mp4 (6, Couldn’t resolve host name) (Could not resolve host: node.plexapp.com)
Nov 30, 2025 18:43:12.422 [140677529656120] Fehler — [Req#ac7f69] HTTP -6 downloading url https://node.plexapp.com:32443/system/services/url/lookup?url=http%3A%2F%2Fcommondatastorage.googleapis.com%2Fgtv-videos-bucket%2Fsample%2FBigBuckBunny.mp4
Nov 30, 2025 18:43:12.422 [140678289795896] Debug — Completed: [192.168.94.150:53998] 404 POST /library/metadata/224322/extras?url=http%3A%2F%2Fcommondatastorage.googleapis.com%2Fgtv-videos-bucket%2Fsample%2FBigBuckBunny.mp4&title=Injection+%28Local%29&extraType=1 (10 live) #ac7f69 GZIP 2ms 379 bytes (pipelined: 1)
Nov 30, 2025 18:43:12.435 [140677436054328] Debug — Request: [88.134.29.122:53999 (WAN)] POST /library/metadata/224322/extras?url=http%3A%2F%2Fcommondatastorage.googleapis.com%2Fgtv-videos-bucket%2Fsample%2FBigBuckBunny.mp4&title=Injection+%28Public%29&extraType=1 (11 live) #ac7ffc GZIP Signed-in Token (rossinior)
Nov 30, 2025 18:43:12.437 [140677436054328] Debug — [Req#ac7ffc/HCl#263b4] HTTP requesting GET https://node.plexapp.com:32443/system/services/url/lookup?url=http%3A%2F%2Fcommondatastorage.googleapis.com%2Fgtv-videos-bucket%2Fsample%2FBigBuckBunny.mp4
Nov 30, 2025 18:43:12.437 [140678249032504] Warnung — [HttpClient/HCl#263b4] HTTP error requesting GET https://node.plexapp.com:32443/system/services/url/lookup?url=http%3A%2F%2Fcommondatastorage.googleapis.com%2Fgtv-videos-bucket%2Fsample%2FBigBuckBunny.mp4 (6, Couldn’t resolve host name) (Could not resolve host: node.plexapp.com)
Nov 30, 2025 18:43:12.437 [140677529656120] Fehler — [Req#ac7ffc] HTTP -6 downloading url https://node.plexapp.com:32443/system/services/url/lookup?url=http%3A%2F%2Fcommondatastorage.googleapis.com%2Fgtv-videos-bucket%2Fsample%2FBigBuckBunny.mp4
Nov 30, 2025 18:43:12.437 [140678287686456] Debug — Completed: [88.134.29.122:53999] 404 POST /library/metadata/224322/extras?url=http%3A%2F%2Fcommondatastorage.googleapis.com%2Fgtv-videos-bucket%2Fsample%2FBigBuckBunny.mp4&title=Injection+%28Public%29&extraType=1 (11 live) #ac7ffc GZIP 2ms 379 bytes (pipelined: 1)

Of course, I tried checking DNS for node.plexapp.com and no DNS server knows this domain: https://dnschecker.org/ns-lookup.php?query=node.plexapp.com&dns=dnsauth

Therefore, what are the limits of using this POST call? Is there another way of adding a new trailer via API?

I cannot find any “rules” for this API call. Is there any help that I can get on this?

The URL in this example is just a dummy… some MP4 to test it. Can somebody please help?

const axios = require(‘axios’);

// — KONFIGURATION (BITTE ANPASSEN!) —
const PLEX_TOKEN = “HIER_DEINEN_TOKEN_EINFÜGEN”; // <— WICHTIG!
const MOVIE_ID = “224322”;

// Wir testen ZWEI Server-Adressen nacheinander:
// 1. Die interne (Localhost:32400) → Umgeht NAT Loopback
// 2. Die öffentliche IP (88…) → Falls Localhost blockiert ist
const SERVERS_TO_TEST = [
“http://192.168.94.52:32400”, // Interner Standard
“http://publicip:32600” // Deine öffentliche Adresse
];

// Ein Dummy-Video, das garantiert funktioniert
const VIDEO_URL = “http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4”;
//const VIDEO_URL = “iva://services/iva/assets/493189/video.mp4?bitrate=2500&X-Plex-Token=KchThn-FsHm7yRzoJzP9”;
const TITLE = “Injection”;

async function runTest() {
if (PLEX_TOKEN === “HIER_DEINEN_TOKEN_EINFÜGEN”) {
console.error(“ FEHLER: Bitte trage erst deinen PLEX_TOKEN im Skript ein!”);
return;
}

console.log("🚀 Starte manuellen Injection-Test (Direct to Plex)...");

for (const serverUrl of SERVERS_TO_TEST) {
    console.log(`\n--------------------------------------------------`);
    console.log(`📡 Teste Server: ${serverUrl}`);

    // Parameter MÜSSEN in die URL (Query String), nicht in den Body!
    const params = new URLSearchParams();
    params.append('url', VIDEO_URL);
    params.append('title', `${TITLE} (${serverUrl.includes('192') ? 'Local' : 'Public'})`);
    params.append('extraType', '1');
    params.append('X-Plex-Token', PLEX_TOKEN); // Auth direkt in URL

    const fullUrl = `${serverUrl}/library/metadata/${MOVIE_ID}/extras?${params.toString()}`;

    console.log(`🔗 Full Request URL: ${fullUrl}`);

    try {
        // Wir senden einen POST mit LEEREM Body ({}), da alle Daten in der URL sind.
        // Das ist der entscheidende Unterschied zum Proxy, der evtl. Daten in den Body schiebt.
        const response = await axios.post(fullUrl, {}, {
            headers: {
                'Accept': 'application/json',
                // Wir setzen keine Content-Type Header für den Body, da er leer ist
            },
            timeout: 10000
        });

        console.log(`✅ STATUS: ${response.status} ${response.statusText}`);
        console.log("📦 DATEN:", JSON.stringify(response.data, null, 2));
        console.log("🎉 ERFOLG! Wenn hier 200 steht, hat es funktioniert.");
        return; // Abbruch bei Erfolg

    } catch (error) {
        console.error(`❌ FEHLER: ${error.message}`);
        if (error.response) {
            console.error(`   Status: ${error.response.status}`);
            console.error(`   Data:`, error.response.data);
        }
    }
}

}

runTest();

Do I need to add this via some other API call and then make it a trailer with this one? Are no real URLs allowed? Is the presence of node.plexapp.com a bug?

I would love to see such a successful POST call from somebody, please. @drzoidberg33 ? Anybody?

1 post - 1 participant