Page 1 of 1
http file upload/REST verbs
Posted: Wed Mar 30, 2011 7:25 pm
by maarten.koopmans
Hi,
I need to upload a file using http with POST (and digest authentication), but I can't get my head around on how to do that. Other than opening a socket, and going all the way deep down..... But that doesn't look like LiveCode?
Also, is there a way to HTTP PUT, DELETE? You know, REST like intrefaces....
Any thoughts greatly appreciated.
--Maarten
Re: http file upload/REST verbs
Posted: Sun May 01, 2011 9:30 am
by interactbooks
Take a look at this library, it's for SOAP based web services but might help you see some use examples that you can apply to the RESTful web services:
http://revonline2.runrev.com/stack/405/LibSOAP
Re: http file upload/REST verbs
Posted: Tue May 10, 2011 12:56 pm
by trevordevore
maarten.koopmans wrote:I need to upload a file using http with POST (and digest authentication), but I can't get my head around on how to do that. Other than opening a socket, and going all the way deep down..... But that doesn't look like LiveCode?
In order to use Digest authentication you have to implement it yourself by means of libUrlSetAuthCallback. I've partially implemented Digest auth in the GLX Application Framework so you could extract the necessary handlers from the library. There are a couple of handlers involved so you will need to download the source in order to take a look.
http://www.bluemangolearning.com/revolu ... framework/
In the distribution folder find the glxapp_framework.dat stack file. Open it in LiveCode and edit the "glxApplicationFramework" stack script. Search for "libUrlSetAuthCallback" and "glxappAuthDigestCallback". glxappAuthDigestCallback makes some calls to other handlers in the library stack such as _DigestAuthToken. You will want to replace the _GetCredentials call to something that returns the proper username/password as _GetCredentials uses some framework specific means to obtain a username/password.
maarten.koopmans wrote:Also, is there a way to HTTP PUT, DELETE? You know, REST like intrefaces....
Code: Select all
PUT: put aVariableWithData into URL theURL
You can use the urlResponse [undocumented I believe] global variable to access the server response when using PUT and DELETE.