PMS web api documentation

other-dev

#1

Here is a (growing) google doc listing the api endpoints for plex media server. If you'd like to add to this please PM me.

 

 

UPDATE:

The google doc has been migrated into the following Github repo: Unofficial Plex API

 

It currently includes the following topics:

  • MediaTypes - Section and media types
  • PlexTv - plex.tv endpoints for things like signing in
  • PlaybackControl - Play to other clients
  • PlexWebAPIOverview - List sections, media, preferences, etc..
  • StatusSessions - "Now Playing" information

#2

Here is a (growing) google doc listing the api endpoints for plex media server. If you'd like to add to this please PM me.

PS: I noticed that with a lot of these plex would first perform an HTTP OPTIONS on the endpoint to (I guess) verify that it indeed belongs to plex. The response of which was only headers, mainly, Access-Control-Allow-Methods and Access-Control-Allow-Headers. You can look more into it via chrome developer tools or firebug (I think. I actually dont use firefox (: ).

I can contribute. I Know a large portion of the api. 

EDIT. I only wonder if a google doc is the correct place for this.


#3

I tried using the Safari / Chrome dev tools and didnt really see how it helped much. perhaps I could use some help w/ it?
I have a few things I just brute force / trial error found when trying to get VoxCommando integration to work until i came to terms that PlexHomeTheatre as a core client kinda sucks and doesnt exactly make sense for it.

I can share when its determined where to put it.


#4

Ok, so I set up a Wiki on google projects that I am going to start actively adding to. If you want to be a contributor Just PM me you gmail address and I will add you.

https://code.google.com/p/plex-api/w/list


#5

I have started the beginnings of this. I will try and dump as much as I know into the wiki over the week.


#6

could you ask Ninja's to pin this thread please


#7

could you ask Ninja's to pin this thread please

Good idea. Done.


#8

Ok, so I set up a Wiki on google projects that I am going to start actively adding to. If you want to be a contributor Just PM me you gmail address and I will add you.

https://code.google.com/p/plex-api/w/list

Returns "The page you asked for does not exists" ;-)


#9

https://code.google.com/p/plex-api/w/list


#10

Does anyone have a working example of how to send a request to the server to remotely begin playback on another client? The old wiki page has an example that I have attempted numerous times and can't seem to get it to work. I'm not really sure what would be wrong with it.

Example...

Server is: 192.168.1.100 on port 32400

Client is 192.168.1.101

http://192.168.1.100:32400/system/players/192.168.1.101/application/playFile?path=http://192.168.1.100:32400/library/metadata/5555

I've also tried

http://192.168.1.100:32400/system/players/192.168.1.101/application/playMedia?key=5371path=http://192.168.1.100:32400/library/metadata/5171

I've tried multiple variations of these based on the documentation on the old wiki page and still can't seem to get it working correctly. Can anyone help me figure this out?


#11

Hey jdfwarrior, I seem to be having the same issue since I have upgraded PHT. I did notice on your last URL it is missing a "&" between "5371" and "path". Does it work for you if you add that? Mine does not. :(

The only other thing I do in mine is I URL encode the path, but I am not sure if that matters or not. i.e. path=http%3A%2F%2F192. etc. And again, mine is still now working either with the path encoded. I believe something must have changed in the PMS or PHT. 


#12

The best way to figure this stuff out is to use Google chrome's developer tools Network tab. Perform the action you are trying to emulate and watch an see what happens.

Here is what happened in plex web (v 2.1.3)

#Client IP: 192.168.1.4
#Host/pms server IP 192.168.1.2
#Remote PMS server ip where content lives 123.123.123.123

GET 192.168.1.4:32400/player/timeline/poll?wait=0&commandID=0
(Returns machine id which is used later)

GET 192.168.10.4:32400/player/playback/playMedia?key=%2Flibrary%2Fmetadata%2F13615&offset=0&machineIdentifier=&address=123.123.123.123&port=32400&protocol=http&containerKey=%2FplayQueues%2F13%3Fown%3D1%26window%3D200&commandID=5

I executed the last command using fiddler with the proper headers and the media played as expected on my Google TV.


#13

Thank you for the reply and guidance, reallistic. I tried it with Chrome's Network developer tools and got a status of 200 back, but it still does not play on my client. This is very strange. I have removed all tools I have coded and simply am entering the URL into the browser to see if I can get it to fire on the client. Any other ideas I could try to get this working? Thanks again. 

http://192.168.1.157:32400/system/players/192.168.1.159/application/playMedia?key=%2Flibrary%2Fmetadata%2F2515&path=http%3A%2F%2F192.168.1.157%3A32400%2Flibrary%2Fmetadata%2F2515

#14

Plex is very specific when it comes to headers. You HAVE to use/include headers if this is not a plex plugin. I encourage you to check out fiddler of which you can copy/paste in all the request headers that you see being called from chrome. For me this worked. But also, what type of dev are you doing? Plex plugin, third party? Have you tried playing content to a different client using plex web?



Sent from my iPhone using Tapatalk


#15

Thank you for the assistance. I had a simple personal use remote working using this URL format in the past, and it suddenly stopped working. Sounds like it will need a bit more advanced coding now to make it work per your guidance. 


#16

What were the headers you used that worked for you?


#17

This is very helpful, first time in weeks I seem to think maybe getting anywhere. I'm trying to use VoxCommando, and just with direct sends from Chrome.

Not sure about the header info, reallistic can you update the doc with more examples? Fiddler is pretty great, thanks!

I tried and noticed the identifier is not the same from http://ip:32400/clients

But still haven't gotten to work unless still missing some header info or something 


#18

I literally copied ALL of the headers that chrome showed. I'll post them in a sec when I get back to my computer. I'll also try and update the doc.



Sent from my iPhone using Tapatalk


#19

Here is the GET I made which started playing content on my google tv

GET http://192.168.1.4:32400/player/playback/playMedia?key=%2Flibrary%2Fmetadata%2F13615&offset=0&machineIdentifier=&address=&port=32400&protocol=http&containerKey=%2FplayQueues%2F13%3Fown%3D1%26window%3D200&commandID=5

Connection: keep-alive
Cache-Control: no-cache
Pragma: no-cache
X-Plex-Version: 2.1.3
X-Plex-Platform-Version: 34.0
Origin: http://localhost:32400
X-Plex-Client-Identifier: 
X-Plex-Target-Client-Identifier: 
X-Plex-Device-Name: Plex Web (Chrome)
X-Plex-Platform: Chrome
X-Plex-Username: 
Accept: text/plain, */*; q=0.01
X-Plex-Product: Plex Web
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36
X-Plex-Device: Windows
DNT: 1

The remote machineid can be found by simply selecting a section in plex web. It will take you to an address as such:

http://plex.tv/web/app#!/server//section/6

or

http://localhost:32400/web/index.html#!/server//section/6

You can also get the machineID and some other information that may be helpful via localhost

http://localhost:32400/


#20

I'm pasting into chrome browser is that is ok, but I can't get to work.

the http://(PMS SERVER):32400/player/playback/playMedia?key=%2Flibrary%2Fmetadata%2F4707&offset=0&machineIdentifier=(PMS ID)&address=(PMS SERVER IP)&port=32400&protocol=http&containerKey=%2FplayQueues%2F13%3Fown%3D1%26window%3D200&commandID=5

I tried the rasplex Plex client for the first ip and i just get a white screen otherwise i get this

 code="2000" status="KeyError: X-Plex-Target-Client-Identifier">
Traceback (most recent call last): File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/runtime.py", line 843, in handle_request result = f(**d) File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/System.bundle/Contents/Code/playerservice.py", line 19, in process_remote_command identifier = Request.Headers['X-Plex-Target-Client-Identifier'] File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/code/sandbox.py", line 111, in _getitem_ = lambda x, y: x.__getitem__(y), File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Platforms/Shared/Libraries/tornado/httputil.py", line 113, in __getitem__ return dict.__getitem__(self, HTTPHeaders._normalize_name(name)) KeyError: 'X-Plex-Target-Client-Identifier'