Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
jeswin
Level 7

GetHeaders from roUrlTransfer

Hi,

I need to get the header values using roUrlTransfer, is it possible?

serverAPI = createObject("roUrlTransfer")
serverAPI.setUrl(api_url)
reqHeaders = serverAPI.GetToString()

the above code will return the result from the api i have called, but i want to get the header values of this response.
0 Kudos
5 Replies

Re: GetHeaders from roUrlTransfer

0 Kudos
jeswin
Level 7

Re: GetHeaders from roUrlTransfer

Yes i have already tried with the following code

serverAPI = createObject("roUrlTransfer")
serverAPI.setUrl(api_url)
xport=CreateObject("RoMessagePort")
    serverAPI.setport(xport)
    msg=wait(0,xport)
    if type(msg) = "roUrlEvent"
      hedtwo=msg.GetResponseHeaders()        
      print hedtwo
    end if


It waits not running after that, also if i giv timeout its running but not returning anything.
Any example
0 Kudos

Re: GetHeaders from roUrlTransfer

Your code is right.
You must catch the headers
0 Kudos
RokuMarkn
Level 7

Re: GetHeaders from roUrlTransfer

You need to call AsyncGetToString before doing the wait.

--Mark
0 Kudos
jeswin
Level 7

Re: GetHeaders from roUrlTransfer

Yes tried,
it returns true but still it waits after that for a long time and nothing runs after that 
0 Kudos