Forum Discussion

paps33's avatar
paps33
Visitor
15 years ago

Question on using POST /launch/

I am trying to send the roku a POST /launch ECP command to launch a particular channel, but keep getting back a "HTTP/1.1 400 Bad Request" response. Say I wanted to launch the Netflix channel. Its my understanding that I simply plug the proper app id (as returned by query/apps) in to the launch command. For example, with Netflix (app id = 12) I send the command:

POST /launch/12 HTTP/1.1 (with the appropriate cr lf following)

For a basic launch of this channel there really aren't any parameters to also put in. Or are there? Am I missing something? I get similar failed responses when trying to launch, say, Vimeo or others.

14 Replies

  • Paps,

    what app are using for the POST? (hyperterminal, c, c#, C++ java etc etc etc, mac, pc, linux etc etc)
  • tdurrant420,

    I've been using both VB and even AutoIt, from/on a PC (XP and Vista). I should note that I also compiled and ran the sample SDK program related to ECP (it uses HTTP 1.0). One thing I noticed with it was that where it does a get/apps the response contains no apps. It gets the header part of the repsonse message back fine, and shows an appropriate number of bytes that should be in the message body. But there is no message body (ie. there's the header , but no data).

    A strange thing is that I had not been using the additional header in POSTs (or GETs). Keypress seemed to work without it. Get/apps had random problems, sometimes there'd be a usable response - sometimes not. But when I got to trying to launch apps nothing worked until I added the additional HOST: header. Now I've gone back and added the header to eveything I do (except the SSDP Discovery of course). That's seems to have produced reliable exchanges.
  • The Roku shouldn't be requiring the Host header, but maybe your client libraries do??

    The sample app should not be requiring the header either. We tested it on Linux and Windows.

    --Kevin
  • For my Philips pronto 9400 remote here is the script that I use. I have a page on my remote that shows my "favorites", In each button I call the function:

    roku_launch(11); //where the value is the id of the channel.

    In the activities page I store the actual function :

    function roku_launch(channel) {
    //System.print(channel);
    var url = CF.widget("aURL","PARAMETERS").label;
    var timeout = CF.widget("aTIMEOUT","PARAMETERS").label;
    var socket = new TCPSocket(true);
    socket.connect(url, 8060, timeout);
    socket.write("POST /launch/"+channel+ " HTTP/1.1\r\n\r\n");
    socket.close();
    }


    This works great.

    Bill