Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
paps33
Visitor

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.
0 Kudos
14 REPLIES 14
RokuChris
Roku Employee
Roku Employee

Re: Question on using POST /launch/

Sounds like you are on the right track. The launch command does not require any parameters. I can successfully launch the Netflix channel using this command from a terminal and substituting the IP address of a Roku:

curl -d "" "http://xxx.xxx.xxx.xxx:8060/launch/12"
TheEndless
Channel Surfer

Re: Question on using POST /launch/

That syntax works fine for me. Are you specifying the HOST header with the appropriate 8060 port?
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
paps33
Visitor

Re: Question on using POST /launch/

Thanks for the responses.

I'm doing a send to the same address/port (port being 8060) that I use for, say, a GET /query/apps or a POST /keypress (which work). The exact data I send is as in my first post, namely (for netflix):

"POST /launch/12 HTTP/1.1" (without the quotes and with two appended carriage return line feeds)

TheEndless, are you saying I need to literally include (append) a "Host: xxx.xxx.xxx.xxx:8060" on to the post data sent?
0 Kudos
RokuMarkn
Visitor

Re: Question on using POST /launch/

Yes, the HTTP protocol requires a Host header. You probably also need a Content-Length:0 header.

--Mark
0 Kudos
paps33
Visitor

Re: Question on using POST /launch/

Ah, so I assume that this is because HTTP 1.1 is being used as opposed to 1.0? But why then is it that if I do a POST for something like the KEYPRESS I have no problem withno header supplied?

Note: In the SDK example program to launch an app they provide no host header, but they use HTTP 1.0.
0 Kudos
RokuKevin
Visitor

Re: Question on using POST /launch/

Here's an example to launch netflix.... insert your ipaddress in the line below:

echo -e "POST /launch/12 HTTP/1.1\r\n\r\n" | ncat 192.168.1.120 8060

--Kevin
0 Kudos
paps33
Visitor

Re: Question on using POST /launch/

RokuKevin,

That may work with ncat, but when (just) the line POST /launch/12 HTTP/1.1\r\n\r\n is sent programatically I get the "400 Bad Request" mentioned initially. I have not try it yet, but it may well be as TheEndless has suggested. With HTTP 1.1 (vs 1.0) the addtional header(s) are needed, at least the HOST: . I will try it and see. If it works then it will be puzzling why something like the POST keypress works without the header. That might mean there is something improper in the ROKU firmware.

I'll post what I find...
0 Kudos
RokuMarkn
Visitor

Re: Question on using POST /launch/

Sorry for the confusion -- it appears that no headers are necessary with either the keypress or launch commands.
The string you are sending should work fine. Make sure you don't have any extraneous characters queued up in the socket (like from a previous command) before you send your command. That could cause the 400 error you're seeing.

--Mark
0 Kudos
paps33
Visitor

Re: Question on using POST /launch/

Well for what it is worth...

When I had been trying to issue a POST launch (HTTP 1.1, not 1.0) without any headers I had no success. I confirmed (I swear) the content of the command text was fine. However, when I now add an additional Host: header (ie. Host: xxxx.xxxx.xxxx.xxxx:8060) the command(s) work and the channels launch. Makes sense, since the HTTP 1.1 spec does say the header (at least the host) is required.

My thanks to TheEndless for putting me on the right track!
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.