this post clearer than before *controllers/api.py* @service.json def get_table(table_name, id): response.headers['key'] = '123' return dict(content = db[table_name](id) )
*terminal* curl -X GET --user admin:password -i http://127.0.0.1:8000/test/api/call/json/get_table/table0/1 --header 'key: your-api-key' *result is not expected, no errors occured* HTTP/1.1 200 OK key: 123 X-Powered-By: web2py Set-Cookie: session_id_test=127.0.0.1-bc128e4d-1fab-1ada-bbbe-9d73cdeffe47; httponly; Path=/ Expires: Sun, 01 Apr 2018 03:33:32 GMT Pragma: no-cache Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Content-Type: application/json; charset=utf-8 Date: Sun, 01 Apr 2018 03:33:32 GMT Server: Rocket 1.2.6 Python/2.7.10 Content-Length: 291 Connection: keep-alive {"content": {"field0": "field0", "field1": "field1", "modified_by": null, "is_active": true, "created_by": null, "id": 1, "created_on": "2018-03-27 11:09:22", "created_from": "127.0.0.1", "modified_on": "2018-03-27 11:09:22", "modified_from": "127.0.0.1"}} *objective* when the key value in curl parameter header is not same like response.headers['key'] the result thrown an error (e.g. 400 with description invalid keys or else) how to do that using web2py way? or perhaps using jwt to do this? not sure, pls enlight thx and 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.