Odoo RESTFUL API

by
Odoo 4
v 12.0 Third Party 1519
Download for 12.0 series Deploy on Odoo.sh
You bought this module and need support ? Click here !
Technical name restful
LicenseLGPL-3
Websitehttps://ajepe.github.io/blog/restful-api-for-odoo
Read description for v 11.0 v 10.0
Technical name restful
LicenseLGPL-3
Websitehttps://ajepe.github.io/blog/restful-api-for-odoo
Read description for v 11.0 v 10.0

Odoo RESTFUL API

This module helps you to connect or integrate any third party application with Odoo.
It provides a fluent and easy HTTP based API interface instead of the Odoo default RPC.
By design Odoo is shipped with RPC API interfaces which may not be straight forward for many developers that are not familiar with the RPC(s). This is module only cares about generating an HTTP response for each HTTP request, it has nothing to do with your or existing application logic. For detailed example of REST API refer
https://ajepe.github.io/posts/restful-api-for-odoo

Please log in to comment on this module

Please choose a rating from 1 to 5 for this module.
Odoo
Thanks it work
by on

This is work for me


Odoo
the answer
by on

Here is the answer for the previous issue: https://stackoverflow.com/questions/45466814/odoo-url-not-found-if-not-auth Regards.


Odoo
not working if no session_id is specified
by on

Hi, (checking this https://ajepe.github.io/posts/restful-api-for-odoo/). It throws 404 if not session_id is specified. What is the correct way to connect without needing to include sessino_id? Thank you.


Odoo
404 Not Foujd
by on

Hi, good module. I'm trying to test this module but it never connects to the url. It only connects if I include 'Cookie': 'session_id=a40de38883ddbf04ab9d070ab950d0216f710a67'. What is the correct way to use this module, I don't want to spedify a session_id into the header. Thank you.


Odoo
by on

@ibyref and @Otto Kalme Can you describe what you are trying to achieve that is giving you an error with the code snippets with that I should be able to help you guys.


Odoo
by on

Odoo
by on

The database name is not valid Access denied


Odoo
fake addon
by on

Doesn't work neither reading nor creating


Odoo
Fix this error please
by on

I just made Read [GET] request in python exactly from your docs in new database with demo data and I got this error: 2018-11-15 13:13:03,595 12853 INFO testmoham odoo.addons.base.models.res_users: Login successful for db:testmoham login:admin from 127.0.0.1 2018-11-15 13:13:03,632 12853 INFO testmoham werkzeug: 127.0.0.1 - - [15/Nov/2018 13:13:03] "GET /api/auth/token HTTP/1.1" 200 - 45 0.019 0.068 2018-11-15 13:13:03,746 12853 INFO testmoham werkzeug: 127.0.0.1 - - [15/Nov/2018 13:13:03] "GET /api/sale.order/ HTTP/1.1" 500 - 76 0.038 0.073 2018-11-15 13:13:03,755 12853 ERROR testmoham werkzeug: Error on request: Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/werkzeug/serving.py", line 209, in run_wsgi execute(self.server.app) File "/usr/lib/python3.6/site-packages/werkzeug/serving.py", line 197, in execute application_iter = app(environ, start_response) File "/home/odoo/odoo12/odoo/service/server.py", line 255, in app return self.app(e, s) File "/home/odoo/odoo12/odoo/service/wsgi_server.py", line 128, in application return application_unproxied(environ, start_response) File "/home/odoo/odoo12/odoo/service/wsgi_server.py", line 117, in application_unproxied result = odoo.http.root(environ, start_response) File "/home/odoo/odoo12/odoo/http.py", line 1317, in __call__ return self.dispatch(environ, start_response) File "/home/odoo/odoo12/odoo/http.py", line 1290, in __call__ return self.app(environ, start_wrapped) File "/usr/lib/python3.6/site-packages/werkzeug/wsgi.py", line 600, in __call__ return self.app(environ, start_response) File "/home/odoo/odoo12/odoo/http.py", line 1485, in dispatch result = ir_http._dispatch() File "/home/odoo/odoo12/addons/auth_signup/models/ir_http.py", line 19, in _dispatch return super(Http, cls)._dispatch() File "/home/odoo/odoo12/addons/web_editor/models/ir_http.py", line 22, in _dispatch return super(IrHttp, cls)._dispatch() File "/home/odoo/odoo12/addons/http_routing/models/ir_http.py", line 394, in _dispatch result = super(IrHttp, cls)._dispatch() File "/home/odoo/odoo12/addons/utm/models/ir_http.py", line 26, in _dispatch response = super(IrHttp, cls)._dispatch() File "/home/odoo/odoo12/odoo/addons/base/models/ir_http.py", line 207, in _dispatch return cls._handle_exception(e) File "/home/odoo/odoo12/addons/utm/models/ir_http.py", line 31, in _handle_exception response = super(IrHttp, cls)._handle_exception(exc) File "/home/odoo/odoo12/odoo/addons/base/models/ir_http.py", line 177, in _handle_exception return request._handle_exception(exception) File "/home/odoo/odoo12/odoo/http.py", line 773, in _handle_exception return super(HttpRequest, self)._handle_exception(exception) File "/home/odoo/odoo12/odoo/http.py", line 312, in _handle_exception raise pycompat.reraise(type(exception), exception, sys.exc_info()[2]) File "/home/odoo/odoo12/odoo/tools/pycompat.py", line 87, in reraise raise value File "/home/odoo/odoo12/odoo/addons/base/models/ir_http.py", line 203, in _dispatch result = request.dispatch() File "/home/odoo/odoo12/odoo/http.py", line 832, in dispatch r = self._call_function(**self.params) File "/home/odoo/odoo12/odoo/http.py", line 344, in _call_function return checked_call(self.db, *args, **kwargs) File "/home/odoo/odoo12/odoo/service/model.py", line 97, in wrapper return f(dbname, *args, **kwargs) File "/home/odoo/odoo12/odoo/http.py", line 337, in checked_call result = self.endpoint(*a, **kw) File "/home/odoo/odoo12/odoo/http.py", line 938, in __call__ return self.method(*args, **kw) File "/home/odoo/addons12/restful/controllers/main.py", line 28, in wrap return func(self, *args, **kwargs) File "/home/odoo/odoo12/odoo/http.py", line 517, in response_wrap response = f(*args, **kw) File "/home/odoo/addons12/restful/controllers/main.py", line 55, in get domain=domain, fields=fields, offset=offset, limit=limit, order=order) File "/home/odoo/odoo12/odoo/models.py", line 4516, in search_read result = records.read(fields) File "/home/odoo/odoo12/odoo/models.py", line 2768, in read values[name] = field.convert_to_read(record[name], record, use_name_get) File "/home/odoo/odoo12/odoo/models.py", line 5042, in __getitem__ return self._fields[key].__get__(self, type(self)) File "/home/odoo/odoo12/odoo/fields.py", line 974, in __get__ self.determine_value(record) File "/home/odoo/odoo12/odoo/fields.py", line 1085, in determine_value self.compute_value(recs) File "/home/odoo/odoo12/odoo/fields.py", line 1041, in compute_value self._compute_value(records) File "/home/odoo/odoo12/odoo/fields.py", line 1032, in _compute_value getattr(records, self.compute)() File "/home/odoo/odoo12/addons/sale/models/sale.py", line 262, in _compute_type_name record.type_name = _('Quotation') if self.state in ('draft', 'sent', 'cancel') else _('Sales Order') File "/home/odoo/odoo12/odoo/fields.py", line 968, in __get__ record.ensure_one() File "/home/odoo/odoo12/odoo/models.py", line 4643, in ensure_one raise ValueError("Expected singleton: %s" % self) ValueError: Expected singleton: sale.order(8, 3, 4, 6, 7, 9, 10, 14, 15, 16) - - -

Odoo
Re: Fix this error please
by on

The error is actually coming from your code