[web2py] Re: Pulling hair out on REST Example

2016-06-21 Thread wdtnh
Been swamped with work and haven't had time to get bet back to this. Thanks for the reply. I will definitely try that. I'm assuming this is simply a stupid mistake on my part. On Thursday, June 16, 2016 at 5:26:01 AM UTC-4, pbreit wrote: > > How about trying some code more like in the bo

[web2py] Re: Pulling hair out on REST Example

2016-06-18 Thread Massimo Di Pierro
as pbreit suggests the problem is that you return a dict or None, instead you want to return json. Here is another option: @request.restful() def testRESTGET(): def GET(): id =1359 account = db.account(id) return account.as_json() if account else '{}' return locals

[web2py] Re: Pulling hair out on REST Example

2016-06-16 Thread pbreit
How about trying some code more like in the book: @request.restful() def api(): response.view = 'generic.json' def GET(): return dict(account = db.account(1359)) return locals() Then just hit http://localhost:8000/myapp/default/api in your browser -- Resources: - http://web2

[web2py] Re: Pulling hair out on REST Example

2016-06-15 Thread Anthony
Is there an error ticket? I notice you're returning a dict, so web2py will attempt to find and execute a view (in this case, a .html view, as you have specified no extension in the URL). However, if there is no view and the generic view hasn't been enabled, you would get a 404 response, not a 50

[web2py] Re: Pulling hair out on REST Example

2016-06-15 Thread wdtnh
The problem is that I get nothing back? I'm getting an http error 500 internal server error. On Wednesday, June 15, 2016 at 5:10:50 PM UTC-4, Anthony wrote: > > What exactly is the problem? What do you see in the browser network tab > (i.e., request and response details) and Javascript consol

[web2py] Re: Pulling hair out on REST Example

2016-06-15 Thread Anthony
What exactly is the problem? What do you see in the browser network tab (i.e., request and response details) and Javascript console (any errors)? On Wednesday, June 15, 2016 at 4:34:18 PM UTC-4, wdtnh wrote: > > I would appreciate any insights anyone might have on what I'm doing wrong > here. F