I'm getting stuck when trying to test a router by calling from Postman
@http.route('/nails/login', type='json', auth="public")
def api_login(self, csrf=False, **kwargs):
and calling in postman with header application/json
http://127.0.0.1:8070/nails/login
but log always return
2018-07-02 14:30:38,123 26497 ERROR ? odoo.http: Exception during JSON request handling.
Traceback (most recent call last):
File "/home/ryu/odoo/odoo-server/odoo/http.py", line 640, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/ryu/odoo/odoo-server/odoo/http.py", line 1453, in _dispatch_nodb
func, arguments = self.nodb_routing_map.bind_to_environ(request.httprequest.environ).match()
File "/usr/local/lib/python2.7/dist-packages/werkzeug/routing.py", line 1573, in match
raise NotFound()
NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
2018-07-02 14:30:38,128 26497 INFO ? werkzeug: 127.0.0.1 - - [02/Jul/2018 14:30:38] "POST /nails/login HTTP/1.1" 200 -
Before calling any API, you have to login using /web/session/authenticate using post request. The reason for the above error is odoo is not able to find session information, therefore unable to find which database to login.
Sample request type:
{
"params": {
"login": "admin",
"password": "admin",
"db": "odoo10"
}
}
Finally I resolved it by adding this in configuration file, ever try but not sure why it's not working before that..
[options]
dbfilter = my_db_name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With