Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

PMS web api documentation

reallisticreallistic Posts: 191Members, Plex Pass Plex Pass

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
Tagged:
«13456

Comments

  • JimBurlisonJimBurlison Plex Notify Creator Posts: 902Members Plex Pass
    edited April 2014
    reallistic wrote on March 30 2014, 10:35 PM: »

    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.

  • vulcanjedivulcanjedi Posts: 443Members, Plex Pass Plex Pass
    edited April 2014

    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.

    Search first, provide details and keep forums clean. Mark things solved, to close them out and acknowledge helpful volunteers who share. If they have helped, let them know.

     

  • JimBurlisonJimBurlison Plex Notify Creator Posts: 902Members Plex Pass
    edited April 2014

    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

  • JimBurlisonJimBurlison Plex Notify Creator Posts: 902Members Plex Pass

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

  • sa2000sa2000 Posts: 28,605Members, Plex Pass, Plex Ninja, Plex Team Member Plex Team Member

    could you ask Ninja's to pin this thread please

    Help given free on forums.            Fee-Based Personal Support & Help.        

    _______________________________________________________________________________________

    Plex Support Information              Troubleshooting               FAQs

    Plex Media Server:   Reporting Issues        Plex Web App: Debug Log    Plex Apps: Support pages and Logs    Logs: All Logs

    For list of 3rd party programs and malware / adware crashing Plex Media Server and mswsock.dll on windows, see Repeated crashing of Plex Media Server on Windows
     
  • mikedm139mikedm139 Plugin Developer Posts: 3,022Members, Plex Pass, Plex Ninja Plex Ninja
    edited April 2014
    sa2000 wrote on April 1 2014, 6:55 PM: »

    could you ask Ninja's to pin this thread please

    Good idea. Done.

    If you are having trouble with one or more channels, check here first.
    If you are asked to provide logs, which you will be if you are having plugin problems, the help center has details on where to find them.
    ***************************************************************************************************************************************
    Check out unofficial channels in the
    UnSupported AppStore
    Follow my efforts on Github and Twitter
    Donate

  • dane22dane22 Posts: 10,195Members, Plex Pass, Plex Ninja Plex Ninja
    JBurlison@Gmail.com wrote on April 1 2014, 5:23 PM: »

    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" ;-)

    I hate bugs - Tommy Lee Jones, MIB
    Join me in developing: epg-dk, str2utf-8, remidx, ExportTools, WebTools
    Support the Samsung Client:Donate
    Guides I use: Media Naming Guide, Local subtitles, Log-Files, QNAP FAQ, The Plex Dance

    NO Support via PM, unless called by me

  • jdfwarriorjdfwarrior Posts: 13Members, Plex Pass Plex Pass

    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?

  • DreamStaticDreamStatic Posts: 58Members, Plex Pass Plex Pass

    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. 

  • reallisticreallistic Posts: 191Members, Plex Pass Plex Pass

    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=<machineid from b4>&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.

  • DreamStaticDreamStatic Posts: 58Members, Plex Pass Plex Pass

    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=/library/metadata/2515&amp;path=http://192.168.1.157:32400/library/metadata/2515
    
  • reallisticreallistic Posts: 191Members, Plex Pass Plex Pass
    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
  • DreamStaticDreamStatic Posts: 58Members, Plex Pass Plex Pass

    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. 

  • DreamStaticDreamStatic Posts: 58Members, Plex Pass Plex Pass

    What were the headers you used that worked for you?

  • vulcanjedivulcanjedi Posts: 443Members, Plex Pass Plex Pass

    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 

    Search first, provide details and keep forums clean. Mark things solved, to close them out and acknowledge helpful volunteers who share. If they have helped, let them know.

     

  • reallisticreallistic Posts: 191Members, Plex Pass Plex Pass
    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
  • reallisticreallistic Posts: 191Members, Plex Pass Plex Pass

    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=/library/metadata/13615&amp;offset=0&amp;machineIdentifier=&lt;remote server id>&address=<remote server ip>&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: <client ID>
    X-Plex-Target-Client-Identifier: <target client ID>
    X-Plex-Device-Name: Plex Web (Chrome)
    X-Plex-Platform: Chrome
    X-Plex-Username: <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/<machine id>/section/6

    or

    http://localhost:32400/web/index.html#!/server/<machine id>/section/6

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

    http://localhost:32400/

  • vulcanjedivulcanjedi Posts: 443Members, Plex Pass Plex Pass

    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

    <Response code="2000" status="KeyError: X-Plex-Target-Client-Identifier">
    <Traceback>
    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 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 <lambda> _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'
    </Traceback>
    </Response>

    Search first, provide details and keep forums clean. Mark things solved, to close them out and acknowledge helpful volunteers who share. If they have helped, let them know.

     

  • jdfwarriorjdfwarrior Posts: 13Members, Plex Pass Plex Pass
    reallistic wrote on April 27 2014, 6:45 PM: »

    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=/library/metadata/13615&amp;offset=0&amp;machineIdentifier=&lt;remote server id>&address=<remote server ip>&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: <client ID>
    X-Plex-Target-Client-Identifier: <target client ID>
    X-Plex-Device-Name: Plex Web (Chrome)
    X-Plex-Platform: Chrome
    X-Plex-Username: <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/<machine id>/section/6

    or

    http://localhost:32400/web/index.html#!/server/<machine id>/section/6

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

    http://localhost:32400/

    What's the difference in client identifier and target client identifier? Similar to vulcanjedi, this isn't a plugin that has client status. I'm actually working on a workflow for Alfred. I have a client (hackintosh) that is connected to my tv and I want to be able to search my library within Alfred and show results, select one, and have it play on the tv through that client. I already have search, play, stop, etc working. I just can't make it play a file. Is there other documentation somewhere that I could see what all parameters it is expecting?

«13456
Sign In or Register to comment.