PMS web api documentation

@rwhapham said:
Is there a way to determine the “secure” status of a server prior to connecting to it? I was hoping that this info would have been added to the PMS/servers endpoint, but it’s not. I want to add support for connecting to a secure server, but want to make sure there’s not a better way than brute force attempting HTTPS first, then falling back to HTTP. Thanks.

May be the certificate=“1” in the xml you get from :32400 default request means that

test with localhost:32400

Or it could be derived from preferences item secureConnections (1 means Preferred, 2 is Disabled)

My XML from one of my servers

<MediaContainer size="16" allowCameraUpload="1" allowChannelAccess="1" allowSync="1" certificate="1" friendlyName="AML-SA-LT" machineIdentifier="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" multiuser="1" myPlex="1" myPlexMappingState="mapped" myPlexSigninState="ok" myPlexSubscription="1" myPlexUsername="xxxxxxx@xxxx.xxx" platform="Windows" platformVersion="6.1 (Build 7601)" requestParametersInCookie="1" sync="1" transcoderActiveVideoSessions="0" transcoderAudio="1" transcoderVideo="1" transcoderVideoBitrates="64,96,208,320,720,1500,2000,3000,4000,8000,10000,12000,20000" transcoderVideoQualities="0,1,2,3,4,5,6,7,8,9,10,11,12" transcoderVideoResolutions="128,128,160,240,320,480,768,720,720,1080,1080,1080,1080" updatedAt="1440508970" version="0.9.12.11.1406-8403350">...</MediaContainer>

There may be other ways to get that info

@sa2000 said:
There may be other ways to get that info

The ‘certificate’ attribute definitely seems to indicate that the server is capable of secure communication. The only problem is that you have to be able to connect to the server to get that info. If a secure connection is required, then I cannot see that XML without connecting using HTTPS. Seems like something that should be in https://plex.tv/pms/servers somewhere, but it’s not.

@rwhapham said:
The ‘certificate’ attribute definitely seems to indicate that the server is capable of secure communication. The only problem is that you have to be able to connect to the server to get that info. If a secure connection is required, then I cannot see that XML without connecting using HTTPS. Seems like something that should be in https://plex.tv/pms/servers somewhere, but it’s not.

Silly me. Sorry. of course

This is the interface the clients use. It is obvious which servers have plex.direct routes

https://plex.tv/pms/resources.xml?includeHttps=1

Thanks guys!

@constantinople11 said:
Need help!
The following code:

$.ajax({
    url: 'https://plex.tv/servers.xml',
    type: 'GET',
    dataType: 'text',
    success: function(text) {
        console.log('hello!');
        console.log(text);
    },
    error: function(xhr, ajaxOptions, thrownError) {
        console.log('boo!');
        console.log('------1----Request Status: ' + xhr.status + ' Status Text: ' + xhr.statusText + '  Ready State: ' + xhr.readyState + 'thrownError: ' + thrownError);
    },
    beforeSend: function(xhr) {
        xhr.setRequestHeader("X-Plex-Token", authentication_token);
        xhr.setRequestHeader('X-Plex-Product', 'Plex Web');
        xhr.setRequestHeader('X-Plex-Version', '2.4.18');
        xhr.setRequestHeader('X-Plex-Client-Identifier', 'o8l5n43vey6qolxr');
        xhr.setRequestHeader('X-Plex-Platform', 'Chrome');
        xhr.setRequestHeader('X-Plex-Platform-Version', '43.0');
        xhr.setRequestHeader('X-Plex-Device', 'Windows');
        xhr.setRequestHeader('X-Plex-Device-Name', 'Plex Web (Chrome)');
        xhr.setRequestHeader('Accept-Language": "en');
    }
});

Gives me the following output:

<!DOCTYPE html>
<html lang="en">

<head>
  <title>Plex</title>

  <meta charset="utf-8">
  <meta http-equiv="refresh" content="1; url=https://app.plex.tv/web/app">
</head>

<body>
  <script type="text/javascript">
    window.PLEXWEB = {


      myPlexScheme: "https",
      myPlexUrl: "plex.tv",
      clientID: "57ad03fe-33a8-420f-b218-73b56cb6e719",
      myPlexAccessToken: "WZ1a3uxidoYBXV3SS6sG"
    };

    var hash = '#!/settings/users/friends';

    window.name = 'Plex:' + JSON.stringify(window.PLEXWEB);
    window.location.href = 'https://app.plex.tv/web/app' + hash;
  </script>
</body>

</html>
  1. Thought I was supposed to get an xml, but only get text
  2. As per the info. here Google Code Archive - Long-term storage for Google Code Project Hosting. thought this https://plex.tv/servers.xml would get a list of servers and their sections, not the above output
  3. Not that I have reached there yet, but how do I handle the latest Users/PIN

Trying to dev a client.

Thanks.

I think you should be using https://plex.tv/pms/servers.xml instead of http://plex.tv/servers.xml.

@rwhapham said:
I think you should be using https://plex.tv/pms/servers.xml instead of http://plex.tv/servers.xml.

Thank you!

@constantinople11 said:
Appreciate any help!

The empty servers xml you got from plex.tv/pms/servers.xml just means servers are not signed in to plex.tv

when i tried plex.tv/servers.xml it redirected to https://app.plex.tv/web/app#!/settings/users/friends ! so obviously an obsolete api

@sa2000 said:

A related query is there a known method to authorize the new user pin feature, will be easy to get the pin from the uer but how and which url will validate the pin, I did a search in the forum but cannot seem to find any api.

Found this Plex Fluid userscript · GitHub but am stull unsure.

/iSh0w

@sa2000 said:

Thank you! , finally figured it out!

Appreciate your help!

@constantinople11 said:
Thank you! , is there a way to user-login-pin after plex sign in.
Appreciate your help!

sorry i have no idea. my knowledge comes from reading log files and i have not done any api or plex related development

I didn’t see it but is there a way to store and retrieve the current playback/resume position for a video via the web api? That is, I am playing a video in a non-Plex client and would like to set the resume position in Plex externally. Thanks.

Do you guys want a place to host all this? I will put it up on GITHUB if you like, now that Google Code is a joke, and gone.

@changosmuertos said:
Do you guys want a place to host all this? I will put it up on GITHUB if you like, now that Google Code is a joke, and gone.

Check the first post, I already migrated the Google Code version to GitHub a while back :wink:

@Arcanemagus

Just saw it, and found it. Thanks. I just noticed no updates in a while.
I am writing integration plugin from the Jasper project to plex.

I already have it working in an XMPP bot for testing. I can tell it in
chat to do whatever I want in plex.

Matthew Curry
Linux Evangelist

If you guys like, I can add anything I find if relevant.
I haven’t made it public yet, as I have to clean up the code. But when I do I will post it here.

@cncb said:
I didn’t see it but is there a way to store and retrieve the current playback/resume position for a video via the web api? That is, I am playing a video in a non-Plex client and would like to set the resume position in Plex externally. Thanks.

Yes you can, depending on what tools you want to use. You can set the old position as a variable in a script, and use it to continue at the same spot when you run the script.

@changosmuertos said:
If you guys like, I can add anything I find if relevant.

Please add anything you find and clean up anything you find wrong! :smiley:

The whole point of having it as a Wiki is that it can be updated by anyone. I fixed up the formatting and added a few things when I moved it over but I know there are things that aren’t fully accurate or are missing from the current state.

Ok, I have a clone of the repo. Not sure if I can push to it. Do you guys
need to give me access?

my github is matt@mattcurry.com

Matthew Curry
Linux Evangelist

Editing isn’t restricted, you should just be able to edit the pages directly.

Fair enough. Will do.

Thanks.

Matthew Curry
Linux Evangelist