HTTP PUT for RESTful Web services on roUrlTransfer?

“RokuJoel” wrote:
It turns out that the SetRequest method of roURLtransfer supports this:

http=createobject(“roURLTransfer”)
http.setRequest(“PUT”)

This is now published in the online SDK:
http://sdkdocs.roku.com/display/sdkdoc/ … eqasString

  • Joel
    Great, thanks!

Just to be clear, you can do setRequest(“DELETE”), as well as PUT, correct? And I know I’m shooting for the moon now, but could you also set it to one of the other even less-used verbs, like PATCH or TRACE? I don’t need these (I can’t think of anyone who does, for things you’d do with a Roku), and am fine if they can’t be used, just want it clearly documented so people don’t go pulling their hair out trying to do something that can’t be done. :slightly_smiling_face:

My understanding is, any verb, but you might have to experiment with if you need to use asyncgettostring() vs asyncpostfromstring() to make them work properly.

  • Joel.

“RokuJoel” wrote:
My understanding is, any verb, but you might have to experiment with if you need to use asyncgettostring() vs asyncpostfromstring() to make them work properly.

  • Joel.Works for me, thanks again.

I was just looking for a way to do a DELETE. I think this thread answers it, but I’m still a little unclear about which method to call to do the actual HTTP call once SetRequest(“DELETE”) has been called. You allays user the “xxxGetToxxx” family of methods?

Any update on this ?

I have to use HTTP DELETE for Restful web services on roUrlTransfer. Please suggest how I can implement this using roUrlTransfer.

I also need this for a DELETE. I understand the .setRequest(“DELETE”) thing, but I need to pass a json string also. I don’t have any problem doing a regular POST with .postFromString(“{…}”). However, even if I setrequest/delete, when I call postfromstring, it looks like it’s doing a POST and not a DELETE.

Anyone figure this one out?

For the record…

request.SetRequest(“DELETE”)
response = request.GetToString()

Does work.

I was originally trying to send a json object as the request body, then use .postFromString(), and that was not working (sending as a POST instead of as a DELETE). Since I was able to change my request so that I no longer needed to do that, this problem is averted for now…

It seems to me though, that this is functionality that was begun but never finished. Is this in the pipeline to be completed?

“scottgarner” wrote:
I was originally trying to send a json object as the request body, then use .postFromString(), and that was not working (sending as a POST instead of as a DELETE).
Can you clarify please - are you saying that .getToString() honors prior .setRequest() but .postFromString() overrides it?

“RokuNB” wrote:
Can you clarify please - are you saying that .getToString() honors prior .setRequest() but .postFromString() overrides it?
Yes. That is precisely what I’m saying.

could you post your code ??? So that we can try to rectify…

“scottgarner” wrote:

“RokuNB” wrote:
Can you clarify please - are you saying that .getToString() honors prior .setRequest() but .postFromString() overrides it?
Yes. That is precisely what I’m saying.
I opened internal ticket on this just and was told that it works. Then i sat and tried setRequest() with both PUT and DELETE, with the following:

getToString()
getToFile()
postFromString()
postFromFile()

I used packet capture and in all 8 cases i saw that the correct http verb (PUT or DELETE) was sent down the wire.
Seems that you were incorrect - and the verb override works.

Please provide a minimal code sample that demonstrates the issue, the way you experience it?

I was wrong!

I set it all up again, but cannot reproduce what I claimed was happening. Therefore, I must be sent for flogging.

Thank you for looking into this. Sorry!

On the plus side, after the experiments i think we can finally put this to rest.
To recap: one can do PUT and DELETE by using the roUrlTransfer.SetRequest() method.

This is an ancient thread and things have changed since it was started over 6 years ago. I’ll close it now - please open a new one if issues found.