Plex 9 remote API

Hi



When can we 3rd party developers see the new remote API? You’ve mentioned a new API before and I’m wondering if it’s the same API that XBMC is using (not HTTP API)?

I’m really interested in how you do the streaming to iOS devices, do you decode the video file before streaming or do you just try to http stream the stuff?



Looking forward to try 9 out tonight!

I am also interested in this. Any docs on the REST-ish HTTP/XML interface? :wink:

X2. 6 hours of scraping and still patiently waiting to play with the shiny new toy. Love the IOS you guys are awesome :smiley: Beer money inbound.

Hi,



I’m interested in the REST API, too. Even if it’s just a posting of raw notes, rather than formal documentation.





Thanks.



Brad

Same here - would be great to have some infomation about the REST API, no matter how complete it is…

Thanks a lot!

As I’m sure you can appreciate, we’re a bit swamped right now with bug reports & queries about all the recent news & updates, so it’ll take a little while before all the new goodies are fully documented. I’ll try to explain the brief concepts behind the new remote API.



Commands take the following form:



http://{server}:32400/system/players/{player}/{controller}/{command}



[list]
[*]**server** - the IP address or host name of the media server
[*]**player** - the name of the computer running a Plex client you want to issue the remote command to. You can get a list of computers running Plex on the network by hitting /clients on the current server.
[*]**controller** - the command controller you wish to use
[*]**command** - the command to issue
[/list]

The following controllers and commands are available:

**Navigation controller**
[list]
[*]moveUp
[*]moveDown
[*]moveLeft
[*]moveRight
[*]pageUp
[*]pageDown
[*]nextLetter
[*]previousLetter
[*]select
[*]back
[*]contextMenu
[*]toggleOSD
[/list]

**Playback controller**
[list]
[*]play
[*]pause
[*]stop
[*]rewind
[*]fastForward
[*]stepForward
[*]bigStepForward
[*]stepBack
[*]bigStepBack
[*]skipNext
[*]skipPrevious
[/list]

**Application controller**
[list]
[*]playFile
[*]playMedia (accepts args: path, key, userAgent (optional), httpCookies (optional), viewOffset (optional))
[*]screenshot (accepts args: width=480&height=270&quality=75)
[*]sendString (accepts args: text=xyz)
[*]sendKey (accepts args: code=01)
[*]sendVirtualKey (accepts args: code=01)
[/list]

So, for example:


http://MacPro.local:32400/system/players/mac-mini.local/navigation/moveDown



The one that might need a bit more explanation is the PlayMedia command. This differs from the old XBMC PlayFile command in that it requires two arguments - the path and the key. The path should be a PMS URL that returns a MediaContainer describing a directory, e.g. /library/sections/2/... The key should be the key attribute of the item within that container that you wish to play. This method has the added benefit of giving Plex enough information to access the metadata of the item rather than just the media (posters and plots show up in the OSD, relationships between tracks within albums are maintained, etc.)

Hope that's enough information to get you started!

sure, that’s something. thanks a lot, i really appreciate it. keep on the great work guys!

I ama having touble getting these commands to work. Any ideas? I am talking to the plex server but not working. Here is form the log.



Any help would be greatly appreciated!





Sep 06, 2010 20:17:27 [0xb07c2000] DEBUG - [com.plexapp.system] Sending command over HTTP: /system/players/Alan%20Ogle%27s%20MacBook%20Pro%20(3)/navigation/moveDown

Sep 06, 2010 20:17:27 [0xb07c2000] ERROR - Error issuing curl_easy_perform(handle): 22

Sep 06, 2010 20:17:27 [0xb07c2000] WARN - Error issuing request to: http://localhost:56119/system/players/Alan%20Ogle's%20MacBook%20Pro%20(3)/navigation/moveDown (22)

Sep 06, 2010 20:17:27 [0xb07c2000] DEBUG - [com.plexapp.system] HTTP reply status 500, with 0 bytes of content.

Sep 06, 2010 20:17:27 [0xb07c2000] DEBUG - [com.plexapp.system] Completed command GET /system/players/Alan%20Ogle%27s%20MacBook%20Pro%20(3)/navigation/moveDown in 0.001241 seconds.

Sep 06, 2010 20:17:49 [0xb0bd2000] DEBUG - Request: GET /system/players/Alan%20Ogle%27s%20MacBook%20Pro%20(3)/navigation/moveDown [::ffff:10.0.1.101]

Sep 06, 2010 20:17:49 [0xb0bd2000] DEBUG - [com.plexapp.system] Sending command over HTTP: /system/players/Alan%20Ogle%27s%20MacBook%20Pro%20(3)/navigation/moveDown

Sep 06, 2010 20:17:49 [0xb0bd2000] ERROR - Error issuing curl_easy_perform(handle): 22

Sep 06, 2010 20:17:49 [0xb0bd2000] WARN - Error issuing request to: http://localhost:56119/system/players/Alan%20Ogle's%20MacBook%20Pro%20(3)/navigation/moveDown (22)

Sep 06, 2010 20:17:49 [0xb0bd2000] DEBUG - [com.plexapp.system] HTTP reply status 500, with 0 bytes of content.

Sep 06, 2010 20:17:49 [0xb0bd2000] DEBUG - [com.plexapp.system] Completed command GET /system/players/Alan%20Ogle%27s%20MacBook%20Pro%20(3)/navigation/moveDown in 0.001268 seconds.

The commands seem to work pretty well for me, thanks for that Jam… I’ve got one question, I have a http ajax script that I use to control plex, I used to be able to put it in the web folder, but by the look of the new structure that’s been retired. If I wanted to place a html file for the plex media server to display via port 32400 where would I put it? Cheers!

I couldn’t get this work. Could you elaborate on how you sent the commands?



You need to use the hostname of the computer, not the friendly name (e.g. "mac-mini.local." vs. "Mac Mini")


No worries, for example, this command worked fine to select a menu item, as Jam says you'll have to replace mac.local with mac-mini.local in your setup by the look of things:

http://:32400/system/players/mac.local/navigation/select

Anyone got any idea on my other question?

This is great, thanks alot Jam for the infomation…

Thanks alot guys. That was really helpful. Got it working. Now just need to get it to work in crestron. I am trying to work on a crestron module for the new plex. I get it to work from within a browser but not from crestron. Something on crestron’s end.

Hi



First of all. Well done with Plex 9. It’s fantastic.

Second. Is there/Will there be a way to query the mediaserver about the contents of the database. Im especially interested in knowing which movies and tvshows the mediaserver contains.



Thanks

/Christian

I don’t think any of the devs have come right out and said what information they will or will not release. Jam has said that their priority right now is squashing bugs.



That said, the protocol is pretty straight-forward. If you use Safari, enable the Develop menu in Preferences, and type something like:



http://mediaserver.local:32400/library/sections/



into the address bar. Under the Develop menu, select ‘Show Web Inspector’. A view slides in from the bottom. Along the toolbar for that view, the Elements tab gives you some information and the Resources tab gives you more information. Digging around through that, trying different endpoints and using an HTTP packet sniffer (like HTTPScoop) will provide you with enough information to get started until formal documentation is released.



You can also try different paths suggested by sniffing around the latest player source code. Some of the old XBMC stuff seems to have survived.



That said, I’d like to volunteer to help document the PMS API.





Brad

Thank you very much Brad



That was extremely helpfull.

That was exactly the information i needed, and it works.



To bad that I can’t know for sure that this will be the final interface definition.



But i can always build a prototype :slight_smile:



/Christian



Same story here. Navigation and playback controls work fine from browser but not when sent from CommandFusion iPhone control (which sends a bare-bones HTTP GET request). I took a look at the packets being sent in each case and the browser packets (iPhone Safari) are much larger, with User-Agent string, Referring URL, Encoding, etc. The CommandFusion packets all cause a 400 error: Bad Request. So my guess is that Plex needs a little more information than CF provides.

Fwiw, I had control of Plex 0.8 from CommandFusion using the XBMC HTTP commands.

Hi guys



I have all the control codes working via the HTTP/etc on the Philips pronto. but how do i start PELX via a http call?

EDIT: This was written before this thread was started, and was merged in to this existing thread. Thus, the question regarding the “new way to access” has been answered and sounds really stupid in this context. However, I would still love to get an answer about the second question regarding streaming/transcoding of media.



I was messing around last night with the HTTP interface to the Plex Media Server via http://localhost:32400 and it looks quite promising. Is this the new way to access the media server or is this something left over from XBMC?



Also, I can browse down and find the particular media file I want to play (and it’s key), but I can’t seem to figure out how to play it. Does anyone know the URL to play a particular piece of media? It was my understanding that Plex would transcode it on-the-fly to the device in question in a format that it could understand. Is it more complicated than an HTTP GET request with the proper format parameters?