I have a similar question as Web2py Newbie.  I want to return all the
rows from a table using a pattern like:

/myapp/api/table

I'm wondering if your answer for Newbie is specific to returning a
single comment with the id of bookmark.id?  How would you code the GET
method to get all the comments?

Thanks!

On Jun 16, 6:43 am, Massimo Di Pierro <[email protected]>
wrote:
> Then you need to call
>
> /myapp/api/as_rest/1.json
>
> where "api" is the controller, "as_rest" is your function, "1" is the
> {bookmark.id}.
>
> On Jun 16, 12:51 am, Web2py Newbie
>
>
>
> <[email protected]> wrote:
> > At the moment it is:
>
> > @request.restful()
> > def as_rest():
> >     def GET(*args,**vars):
> >       patterns = ['/{bookmarks.id}',
> >                   '']
> >       parsed = db.parse_as_rest(patterns,args,vars)
> >       if parsed.status==200: return parsed.response.json()
> >       else:
> >         posts = db().select(db.bookmarks.ALL)
> >         return response.render('posts/index.html', locals())
>
> > On Jun 16, 12:58 pm, Massimo Di Pierro <[email protected]>
> > wrote:
>
> > > please show us your code.
>
> > > On Jun 15, 2:25 am, Web2py Newbie
>
> > > <[email protected]> wrote:
> > > > As a follow up:
>
> > > > I want to use something like:
> > > > /myapp/api/show_comment/id
> > > > to show comment at id
> > > > and
> > > > /myapp/api/show_comment/
> > > > To show all comments
>
> > > > However, when I try this it complains ("invalid arguments").  I try to
> > > > test id against None, but id is apparently a server object.
> > > > Any ideas or do I just have to define all_comments?- Hide quoted text -
>
> - Show quoted text -

Reply via email to