yezyilomo / odoo-rest-api

Module which expose Odoo as a REST API
MIT License
202 stars 162 forks source link

Odoo server error #50

Open mauryasoftware opened 4 years ago

mauryasoftware commented 4 years ago

I am getting this issue

{ "jsonrpc": "2.0", "id": null, "error": { "code": 200, "message": "Odoo Server Error", "data": { "name": "odoo.exceptions.AccessDenied", "debug": "Traceback (most recent call last):\n File \"/home/om/odoo-dev/odoo-12/odoo/odoo/http.py\", line 656, in _handle_exception\n return super(JsonRequest, self)._handle_exception(exception)\n File \"/home/om/odoo-dev/odoo-12/odoo/odoo/http.py\", line 314, in _handle_exception\n raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])\n File \"/home/om/odoo-dev/odoo-12/odoo/odoo/tools/pycompat.py\", line 87, in reraise\n raise value\n File \"/home/om/odoo-dev/odoo-12/odoo/odoo/http.py\", line 698, in dispatch\n result = self._call_function(self.params)\n File \"/home/om/odoo-dev/odoo-12/odoo/odoo/http.py\", line 346, in _call_function\n return checked_call(self.db, *args, *kwargs)\n File \"/home/om/odoo-dev/odoo-12/odoo/odoo/service/model.py\", line 97, in wrapper\n return f(dbname, args, kwargs)\n File \"/home/om/odoo-dev/odoo-12/odoo/odoo/http.py\", line 339, in checked_call\n result = self.endpoint(*a, kw)\n File \"/home/om/odoo-dev/odoo-12/odoo/odoo/http.py\", line 941, in call\n return self.method(*args, *kw)\n File \"/home/om/odoo-dev/odoo-12/odoo/odoo/http.py\", line 519, in response_wrap\n response = f(args, kw)\n File \"/home/om/odoo-dev/odoo-12/community/odoo-rest-api-master/controllers/controllers.py\", line 44, in authenticate\n try:\nodoo.exceptions.AccessDenied: login is required.\n", "message": "login is required.", "arguments": [ "login is required." ], "exception_type": "access_denied" } } }

yezyilomo commented 4 years ago

It looks like you are not passing login parameter when authenticating your user, you should pass login, password and db.

yezyilomo commented 4 years ago

Your request body should look like

{
    "params": {
         "login": "your@email.com",
         "password": "yor_password",
         "db": "your_db_name"
    }
}
mauryasoftware commented 3 years ago

I am getting wrong status, its always given me 200 Ok. whenever i need to get different status for wrong value passing see attachment file status and error message. Screenshot-from-2020-09-23-14-44-50

daolvcntt commented 3 years ago

I am getting this issue. Please help me. I using odoo 14 { "jsonrpc": "2.0", "id": null, "error": { "code": 200, "message": "Odoo Server Error", "data": { "name": "werkzeug.exceptions.BadRequest", "debug": "Traceback (most recent call last):\n File \"/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py\", line 237, in _dispatch\n result = request.dispatch()\n File \"/usr/lib/python3/dist-packages/odoo/http.py\", line 683, in dispatch\n result = self._call_function(**self.params)\n File \"/usr/lib/python3/dist-packages/odoo/http.py\", line 326, in _call_function\n raise werkzeug.exceptions.BadRequest(msg % params)\nException\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/usr/lib/python3/dist-packages/odoo/http.py\", line 639, in _handle_exception\n return super(JsonRequest, self)._handle_exception(exception)\n File \"/usr/lib/python3/dist-packages/odoo/http.py\", line 315, in _handle_exception\n raise exception.with_traceback(None) from new_cause\nwerkzeug.exceptions.BadRequest: 400 Bad Request: <function Home.index at 0x7fbe7a992a60>, /: Function declared as capable of handling request of type 'http' but called with a request of type 'json'\n", "message": "400 Bad Request: <function Home.index at 0x7fbe7a992a60>, /: Function declared as capable of handling request of type 'http' but called with a request of type 'json'", "arguments": [], "context": {} } } }

cicciob95 commented 3 years ago

I had the same problem but I realized that I had inserted an / more ... so check the URI