http file upload/REST verbs

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
maarten.koopmans
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 20
Joined: Sun Dec 28, 2008 3:26 pm

http file upload/REST verbs

Post by maarten.koopmans » Wed Mar 30, 2011 7:25 pm

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

interactbooks
Posts: 65
Joined: Thu Oct 07, 2010 4:47 pm

Re: http file upload/REST verbs

Post by interactbooks » Sun May 01, 2011 9:30 am

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

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Re: http file upload/REST verbs

Post by trevordevore » Tue May 10, 2011 12:56 pm

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

Code: Select all

DELETE: delete URL theURL
You can use the urlResponse [undocumented I believe] global variable to access the server response when using PUT and DELETE.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

Post Reply