there are many dialects of rest so there are many ways to do it.
You can do something like this:
import gluon.contrib.simplesjon as json
def delete():
### http://..../delete/1
return db(db.book.id==request.args[0]).delete()
def create():
### http://..../create?fields=<fields in json>
return db.book.insert(**json.loads(request.vars.fields)
def update():
### http://..../update/1?fields=<fields in json>
return db(db.book.id==request.args[0]).insert(**json.loads
(request.vars.fields)
def listall():
### http://..../listall
return db().select(db.book.ALL).json()
Massimo
On Feb 13, 1:25 pm, Miguel Goncalves <[email protected]>
wrote:
> Hi
>
> I would like to create a RESTfull web service with web2py using JSON as the
> 'encoding' format.
>
> Suppose I would have a model containing the following data:
>
> -book_id
> -title
> -author
> -brief_description
>
> and I want CRUD functions accessible through a REST web service.
> How would I go about that?
>
> Thanks
> Miguel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---