myPlex access with HTTP API

Hi,



does anyone know how to get myPlex informations via the Plex Media Server HTTP API?

The response xml for “localhost:32400” shows a new entry “myplex” but when requesting “localhost:32400/myplex” I get a 404 status code. My guess is that I need to send some further informations like the login, but I don’t know how. Maybe someone can help me out. Thanks.

I would like to know about http://localhost:32400/search giving a 404 error.



Did you make any progress on this? I have been looking for some information how to query myPlex to get the list of servers and their associated tokens but haven't been too successful. I have even been splunking in the the elan-plex source on GitHub but I am a bit unsure as to what the cURL USERNAME and PASSWORD options do to the URL or payload. It looks like I need to set some header options then do something with the username and password and finally post it to sign_in.xml (I don't have my source code in front of me so I am doing this from memory) but it isn't working yet.

Anyone have some information about this?

Cheers,
Clint

Hey Clint!



Here are the headers that can be sent to myPlex:



X-Plex-Platform (Platform name, eg iOS, MacOSX, Android, LG, etc)

X-Plex-Platform-Version (Operating system version, eg 4.3.1, 10.6.7, 3.2)

X-Plex-Provides (one or more of [player, controller, server])

X-Plex-Product (Plex application name, eg Laika, Plex Media Server, Media Link)

X-Plex-Version (Plex application version number)

X-Plex-Device (Device name and model number, eg iPhone3,2, Motorola XOOM™, LG5200TV)

X-Plex-Client-Identifier (UUID, serial number, or other number unique per device)



Not all of them are required, but please try to send as many as you can so we can track what clients and devices are being used to access the service :slight_smile:



You should sign in by issuing a POST request to https://my.plexapp.com/users/sign_in.xml. The username and password should be sent using HTTP Basic Auth. If the request is successful, you’ll get XML back containing an auth token. Subsequent requests should append the token to the query string as the auth_token parameter.



Once you’re signed in, you can get the server list from https://my.plexapp.com/pms/servers.xml.

1 Like

localhost:32400/myplex/account 


gives you something like this (if logged into myplex):


<MyPlex authToken="<Hash>" username="<email>" mappingState="mapped" mappingError="" mappingErrorMessage="" signInState="ok" publicAddress="<IP>" publicPort="32400" privateAddress="" privatePort="0"/>



using

https://my.plexapp.com/pms?X-Plex-Token=<Hash>



gives you something like this:


<MediaContainer friendlyName="myPlex" machineIdentifier="<Other Hash>" identifier="com.plexapp.plugins.myplex" size="3"><br />
   <Directory key="library" title="library"/><br />
   <Directory key="servers" title="servers"/><br />
   <Directory key="system" title="system"/><br />
</MediaContainer>



also interesting:

https://my.plexapp.com/pms/playlists?X-Plex-Token=<Hash><br />
https://my.plexapp.com/pms/playlists/queue?X-Plex-Token=<Hash><br />
https://my.plexapp.com/pms/playlists/queue/unwatched?X-Plex-Token=<Hash><br />
https://my.plexapp.com/pms/playlists/queue/watched?X-Plex-Token=<Hash>



Thanks!

I was able to query the myPlex site to get the auth_token which I then used to query the servers. I also noticed that I could use the same token when talking to my own server over the internet by entering it as the X-Plex-Token. I assume this is what I am supposed to do? One thing I observed is that I have received different tokens and they all still work against my own server? Is that correct? What causes them to change and why are old ones still valid? If I change the token slightly I get a 403 forbidden message which is what I would expect.


Cool. I will check out some of your suggestions.


Any official documentation on how to write a client for this?

Updated https://forums.plex.tv/topic/104353-pms-web-api-documentation/ google API doc with this information.

Thanks, figured it out!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.