On Tuesday, November 24, 2015 at 11:21:05 AM UTC-8, Dave S wrote:
>
>
>
> On Tuesday, November 24, 2015 at 8:33:20 AM UTC-8, Jose wrote:
>>
>> Hi Leonel
>>
>> How it is handled on the server (web2py app)? 
>>
>
> Does this help explain it?
>
> <URL:
> http://web2py.com/books/default/chapter/29/10/services#Restful-Web-Services
> >
>
> I've used the SOAP service model successfully -- the RESTful subset, 
> anyway -- but haven't done a pure REST service yet, but the book has a good 
> description and you should be able to find some threads in the group 
> archives with additional examples.
>
>
I can now answer in more detail, as I've actually done it now.

After doing an upload page based on  the Image Blog example in Chapter 3, I 
moved on to RESTing on curl.  The Chapter 10 material was helpful, as was 
Chapter 6 under "More on uploads".

The archive has some older posts that helped me, and actually pushed me 
across the finish line:

https://groups.google.com/d/msg/web2py/9UO3lP7Jmgk/tv98DecbmCwJ
Date: Wed, 15 Feb 2012 12:25:24 +0000
Subject: Re: [web2py] Re: can we use JSONRPC to upload?
(From Antonio Ramos)

<URL:https://groups.google.com/d/msg/web2py/c2kxBRRKDqA/Tnq0dLAfxpAJ>
Subject: Re: [web2py] Re: Auto-generate PUT and DELETE methods
Date: Wed, 20 Jun 2012 20:42:17 -0700 (PDT)
(From Massimo)

https://groups.google.com/d/msg/web2py/vOPNCflxNPY/2CQLasbTXxoJ
Date: Thu, 10 Sep 2009 13:36:13 -0700 (PDT)
Subject: Re: Database administration - db upload field
From: mdipierro <[email protected]>
(Massimo, earlier)


I'm using cStringIO.StringIO on the request data, but I'm sending binary 
(curl -H "Contnt-Type: application/octet-stream"), and the file is stored 
in uploads with a .txt extension, which makes Firefox think it should maybe 
open it with gedit (when right clicking from the appadmin page).  Saving 
the download to a file is okay, and I can untar a tar file, and another 
binary file compares okay, but it would be nice to get the type correct on 
download.

Also, I had to the use the "def POST(*args, **vars)" form, and couldn't 
figure out how to do it the parse_as_restfull() technique, partly because I 
couldn't figure out the URL and curl invocation to handle the file data. 
 Furthermore, the curl -T doesn't seem to be putting the local filename 
into the POST, whereas the SQLFORM does.  I have an fname field, which is 
redundant in the SQLFORM version, but is what I use in the RESTful upload.

So I finally did Yet Another Web2Py Trick.  The SQLFORM version took me 
half an hour or less, and then I broke things for a while trying to see 
what the POST url looked like, and then spent the rest of the afternoon on 
the REST.

/dps "YAW2PT-count++"

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to