How to implement token based restful api in web2py

985 views
Skip to first unread message

Rakesh Sinha

unread,
Jul 11, 2016, 2:11:38 AM7/11/16
to web2py-users
Hi All,
I am very new to web2py. I need to create some token based REST APIs which will be consumed by other web application (Also written in web2py).
How do we do that in web2py? I have used djanfo REST Framework, is there anything similar in web2py? Please help. Thaks in advance .

Massimo Di Pierro

unread,
Jul 11, 2016, 8:38:36 AM7/11/16
to web2py-users
This is what the manual has to say about it:


If you are willing to try something more beading edge:

    http://experts4solutions.com/collection2/default/examples

The latter is experimental, requires both web2py and pydal trunk, and we cannot yet promise backward compatibility.

Massimo

Marlysson Silva

unread,
Jul 11, 2016, 8:43:13 AM7/11/16
to web2py-users
Without to use DBAPI but still it would be possible to build API Rest with web2py using @restful?

Managering dal mannualy

Anthony

unread,
Jul 11, 2016, 9:06:10 AM7/11/16
to web2py-users
On Monday, July 11, 2016 at 8:43:13 AM UTC-4, Marlysson Silva wrote:
Without to use DBAPI but still it would be possible to build API Rest with web2py using @restful?

Managering dal mannual

Please read the documentation suggested: http://web2py.com/books/default/chapter/29/10/services?search=restful#Restful-Web-Services. The entire purpose of that functionality is to implement REST APIs. You don't necessarily even need to manage the DAL manually, as there is already some built-in functionality to automate many database operations.

Anthony

Massimo Di Pierro

unread,
Jul 12, 2016, 4:39:18 AM7/12/16
to web2py-users
TW. The name is going to change today. DBAPI will be renamed something else.

botass...@gmail.com

unread,
Jul 13, 2016, 3:53:51 AM7/13/16
to web2py-users
Massimo, i've downloaded your example with APIMaker and getting error:

<type 'exceptions.TypeError'> json() got an unexpected keyword argument 'indent'

File "applications\collection2\modules\apimaker.py", line 294, in process
    return response.json(res, indent=2)+'\n'

вторник, 12 июля 2016 г., 11:39:18 UTC+3 пользователь Massimo Di Pierro написал:

Massimo Di Pierro

unread,
Jul 14, 2016, 10:16:19 AM7/14/16
to web2py-users
You need the latest version of web2py. response.json has been patched in this and other ways.

botass...@gmail.com

unread,
Jul 14, 2016, 10:58:55 AM7/14/16
to web2py-users
I'm using 2.14.6. I solved this by just removing indent=2
Message has been deleted

Dave S

unread,
Jul 14, 2016, 2:28:50 PM7/14/16
to web2py-users


On Thursday, July 14, 2016 at 7:58:55 AM UTC-7, botass...@gmail.com wrote:
I'm using 2.14.6. I solved this by just removing indent=2

I think Massimo was suggesting the developer's version (aka "tip of trunk").

/dps

botass...@gmail.com

unread,
Jul 14, 2016, 11:17:56 PM7/14/16
to web2py-users
Ok. Thank you.

четверг, 14 июля 2016 г., 22:28:50 UTC+4 пользователь Dave S написал:
Reply all
Reply to author
Forward
0 new messages