API RESTFul no web2py
Este artigo é uma cópia do original em http://www.web2pyslices.com/slice/show/1533/restful-api-with-web2py acessado em 06/04/2021 18:55 autor Bruno Rocha Hi, 1. Create an app in web2py admin panel 2. In models/db.py define a table named entries Entries = db . define_table ( "entries" , Field ( "entry" , "text" )) 3. Register a new user in http://localhost:8000/myapp/default/user/register 4. Go to appadmin http://localhost:8000/myapp/appadmin and Add a couple of entries. 5. now add the RESTful services to the default.py controller as described in http://goo.gl/iITNd ('parse_as_rest') or here: http://goo.gl/ltfa2 @request . restful () def api (): response . view = 'generic.' + request . extension def GET (* args ,** vars ): patterns = 'auto' parser = db . parse_as_rest ( patterns , args , vars ) if parser . status == 200 : return dict ( content = parser . respons...