myPlex Queue API How-to - Plex Blog

myPlex Queue API How-to

, , | 12 Nov 2011 | by 18 Comments

Hi Guys! André here, taking a break from working on myPlex to give you an update on how it’s going. Since we launched almost two weeks ago, myPlex has gotten off to a very rousing start. Sophisticated and good-looking Plex users (that’s all of you) have been queueing videos from all over the internet to watch later in one of the many Plex clients.

Enterprising Plex users have even created Chrome and Safari extensions to allow queueing videos directly. Those clever coders have already figured out the HTTP requests to add an item to your myPlex queue. But we want everyone to be able to add to their queues as easily as possible.

So, I thought this would be a good time to explain how those requests work. Armed with this information, you will be able to add “Plex It!” functionality to any program or script that can make HTTP requests. If you’re not the kind of person who “adds functionality to any program or script”, I suggest instead that you bask warmly in the knowledge that there will soon be even more ways to add videos to your myPlex queue.

Anyway, back to adding videos to the queue. Once you have a myPlex account, you only need one thing to queue a video: the URL. As long as you give myPlex the URL of the page with the video on it, we will handle the rest of the work. While not every website with videos works yet, rest assured that we are busily working to expand myPlex to encompass all videos, everywhere.

All requests to myPlex must be made over HTTPS, and must be authenticated. The easiest way to authenticate is to just use HTTP Basic Authentication with your myPlex username and password. Once you have an account and a URL, though, adding a queue item is very easy. How easy, you ask? Let me show you with curl.

$ curl -i -u "username:PASSWORD"  
    --data-urlencode 'url=http://www.youtube.com/watch?v=FCSBoOcGFFE'  
    https://my.plexapp.com/queue/items  
HTTP/1.1 200 OK 

That’s it! Next time you load up Plex on your TV or mobile-handheld-thingy-of-choice, you will be presented with the chance to find out exactly how reality hits you, bro.

That’s all for now, but if you’re writing an application or client that integrates with myPlex, stay tuned! I’ll be writing a followup post explaining how you can connect to a myPlex user’s account without storing their password.

FacebookTwitterGoogle+LinkedIn
Share this

18 Comments so far

  1. claude November 12th, 2011 12:53 am

    cool! looking forward to see more ways to add videos to the queue! :-)

  2. anville November 12th, 2011 7:51 am

    I tried supplying the direct URL to an m4v video file, but not playable. Should that work?

  3. David November 12th, 2011 8:10 am

    plex is going to be mainstream and huge, where can i buy some shares? :-)

  4. elan November 12th, 2011 12:24 pm

    @anville: right now direct links to videos do not work. The reason for this is that we want to collect metadata about the video, so the URL to the page its on is what should be passed. In the future, andre will explain advanced ways of passing direct links to videos along with full metadata to the queue.

  5. wolfienuke November 13th, 2011 5:50 am

    Since myPlex was added, all the previous methods of forcing a library/section update have been removed (AFAIK). Is there a new way to force an update by using curl? ie. I am using sabnzbd and used to have a script update when the download is complete. For me (and possibly many other users) there is no need for pms to recheck the folders continuously or on a set schedule if pms is told when to search for new items.

  6. elan November 13th, 2011 10:33 am

    Wolfienuke, those API methods should still exist. If you post logs we can help out more and see what’s going on.

  7. jedi November 13th, 2011 10:40 am

    can we get plex client 0.9.5.1 for macosx/android working first?

  8. anville November 13th, 2011 1:20 pm

    Thanks for the info, Elan. For me, the metadata is not such a big deal, as long as I can get to the content. Sort of like when the the PMS scanners find a file, and immediately add it to the library. Just using the base file name is fine.

    Obviously it would be great to give the containing page, and have the video be parsed out, but there are a lot of sites hosting video out there, and don’t want to have to wait for the parser to be written for each one! (For what it’s worth, here’s the page I was trying it out on: http://ifanboy.com/podcasts/ifanboy-episode-235-robert-kirkman-at-new-york-comic-con-2011/ )

  9. John November 16th, 2011 6:43 am

    Any plans to allow queuing through email? The TouchPad doesn’t allow any bookmarklets or browser plugins, so email would be great!

  10. Plhnt November 17th, 2011 8:52 am
  11. elan November 18th, 2011 4:22 pm

    @Plhnt: as you’ve noticed since posting this comment, absolutely :)

  12. Jose January 9th, 2012 7:08 am

    Would it be possible to send the url along with a description to override the description you guys gather from the video source? Something like:
    “url=http://www.youtube.com/watch?v=iTGkf2yuBz8″,
    “desc=my%20own%20description”

  13. elan January 10th, 2012 12:24 pm

    @Jose: There is an advanced version of the API which allows you to post *all* metadata if you want. However, there’s no way to just override a single field.

  14. bfg67 April 27th, 2012 1:23 am

    I think it would be really handy to have a section on the myplex browser page to input a URL which then adds to the queue – would be useful for places where videos are blocked, and you cannot use an extension

    Related: is there an add-on for IE? I am forced to use it at work

  15. Michael Gammon August 18th, 2012 10:50 am

    I can not down load video to my Plex, my Plex it button has gone, I cannot drag another one to my favorites bar

  16. Francesco January 18th, 2013 11:28 pm

    @elan: Please, can you get me a way to find some documentation about that you call “advanced version of the API which allows you to post *all* metadata”?

    Please, I’m waiting than more an year for that! :]
    If there is not any documentation about, can you indicate me where I can find some piece of code of the api to understand how it works, what params it’s looking for, etc?

    Thank you!!

  17. elan January 22nd, 2013 3:18 pm

    @Francesco: Watch the Plex Media Server.log and edit metadata in Plex/Web :)

  18. branic December 2nd, 2013 10:07 pm

    Something I just noticed with the chrome plug-in. It does not seem to store your account information. If you have not logged into myPlex during the session then it will just look like the button isn’t working.

    Work around: Log into myPlex first thing when you open chrome. Should work after that connection is complete.

Leave a reply