after several test and relearn from the book
*controllers/api.py*
def http_api_key():
api_key = request.env.http_api_key # change api_key with the parameter you 
want in curl request header
if api_key == 'your_api_key':
query = (db.table0.id > 0)
rows = db(query).select()
else:
rows = {'status':'Invalid API Key'}
return response.json(rows)

*terminal return the value*
curl -X GET -i http://127.0.0.1:8000/test/api/http_api_key --header 
'api_key: your_api_key'

*terminal return bad value 'Invalid API Key' because the api_key in header 
is mismatch*
curl -X GET -i http://127.0.0.1:8000/test/api/http_api_key --header 
'api_key: your_api_key0'

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to