On 3 Apr 2011, at 08:50, Maarten Koopmans wrote:

> Hi,
> 
> I there a way to have LIvecode do PUT and DELETE via http/https,
> hopefully witj digest authentication? So you can use the UI tools to
> integrate with REST services? I see great chanches here :-)

You may be able to get this to work using libUrlSetCustomHttpHeaders. This 
command lets you set the request line and any necessary headers in the http 
request.

For delete it might work something like this:

  put "DELETE /path/to/resource HTTP/1.1" & cr into tRequest
  put "Host: www.yourdomain.com" & cr after tRequest
  // add any other headers here but above is probably minimum

  get url "http://www.yourdomain.com/path/to/resource";

For PUT:

  put "PUT /path/to/resource HTTP/1.1" & cr into tRequest
  put "Host: www.yourdomain.com" & cr after tRequest
  put "Content-length: <length of data>" & cr after tRequest
 // add any other headers here

post myData to url  "http://www.yourdomain.com/path/to/resource";

You should use "get" for DELETE and "post" for PUT to ensure the libUrl 
internals behave appropriately. I'm assuming that DELETE requires some kind of 
response message from the server (haven't looked at the spec for a while). If 
that's not the case, you may get an error, even if it worked correctly.

After using libUrlSetCustomHttpHeaders, the headers get reset (different from 
httpHeaders), so you should set this before each call.

I haven't tested either of these before. But worth testing perhaps before 
building your own from scratch.

Good luck!
Dave
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to