MuK REST API for Odooby MuK IT http://www.mukit.at
|Lines of code||4811|
|License||See License tab|
|Also available in version||v 14.0 v 11.0 v 13.0 v 15.0 v 10.0|
MuK REST API for Odoo
A customizable Restful API for Odoo
MuK IT GmbH - www.mukit.at
Enables a REST API for the Odoo server. The API has routes to authenticate and retrieve a token. Afterwards, a set of routes to interact with the server are provided. The API can be used by any language or framework which can make an HTTP requests and receive responses and works with both the Community and the Enterprise Edition.
In case the module should be active in every database just change
the auto install flag to
. To activate the routes even if no database is selected the module
should be loaded right at the server start. This can be done by
editing the configuration file or passing a load parameter to the
Authentication with the server can be done either via OAuth1 or OAuth2.
are supported by the API
OAuth1 - Authentication
Temporary Credentials Acquisition
OAuth2 - Authentication
These API endpoints can be used to communicate with the system
These API endpoints can be used to communicate with Odoo models
These API endpoints can be used to check access rights
These API endpoints can be used to interact with the database
Testing the API
In addition to the sample code, the API can also be tested using our demo page. A short explanation video will help you to get started. You can use the following credentials for authentication:
Client ID: MobileApplicationFlowDemoClientKey
In addition to the existing API endpoints, more can easily be added. It is not necessary to write any kind of code. New endpoints can be created in the backend and are immediately available through the API.
Different types of endpoints can be created. For example the domain evaluation can be used to query certain data and return it via the API.
Contect to the API
Since the API follows the OAuth1 and OAuth2 standards, it is advisable to use a suitable client that can be found in almost every programming language. A list of some of them can be found at this link.
import json import requests from requests_oauthlib import OAuth2Session from oauthlib.oauth2 import LegacyApplicationClient client_id = 'LegacyApplicationFlowDemoClientKey' client_secret = 'LegacyApplicationFlowDemoClientSecret' token_url = 'https://demo12.mukit.at/api/authentication/oauth2/token' username = 'demo' password = 'demo' scope = ['all'] oauth = OAuth2Session( client=LegacyApplicationClient(client_id=client_id) ) token = oauth.fetch_token( token_url=token_url, username=username, password=password, client_id=client_id, client_secret=client_secret ) print(oauth.get("https://demo12.mukit.at/api/user").json())
Find more examples about how to connect to the API via a OAuth client in the documentation.
Extend the API
Even if the API is extended using Python code, the REST API framework provides a number of helpers. Keep in mind that if these extensions are included in a new module, it may also have to be loaded as a global module to make the created endpoints available without a selected database.
from odoo import http from odoo.http import request, Response from odoo.addons.muk_rest import tools from odoo.addons.muk_rest.utils.json import ResponseEncoder class ModelController(odoo.http.Controller): @odoo.http.route([ '/api/myapp/myroute' ], auth="none", type='http', methods=['GET'], csrf=False) @tools.common.parse_exception @tools.common.ensure_database @tools.common.ensure_module() @tools.security.protected() def myroute(self, **kw): result = ... content = json.dumps(result, sort_keys=True, indent=4, cls=ResponseEncoder) return Response(content, content_type='application/json;charset=utf-8', status=200)
Read more about creating your own API and how to use the provided helpers in the documentation.
Help and Support
Feel free to contact us, if you need any help with your Odoo integration or addiontal features.
You will get 30 Days free support incase of any bugs or issues (Except data recovery or migration).
Enables a REST API for the Odoo server. The API has routes to authenticate and retrieve a token. Afterwards, a set of routes to interact with the server are provided.
A generic, spec-compliant, thorough implementation of the OAuth request-signinglogic for Python. To install OAuthLib please follow the instructions or install the library via pip.
pip install oauthlib
To install this module, you need to:
Download the module and add it to your Odoo addons folder. Afterward, log on to your Odoo server and go to the Apps menu. Trigger the debug mode and update the list by clicking on the "Update Apps List" link. Now install the module by clicking on the install button.
Another way to install this module is via the package management for Python (PyPI).
To install our modules using the package manager make sure odoo-autodiscover is installed correctly. Then open a console and install the module by entering the following command:
pip install --extra-index-url https://nexus.mukit.at/repository/odoo/simple <module>
The module name consists of the Odoo version and the module name, where underscores are replaced by a dash.
sudo -H pip3 install --extra-index-url https://nexus.mukit.at/repository/odoo/simple odoo11-addon-muk-utils
Once the installation has been successfully completed, the app is already in the correct folder. Log on to your Odoo server and go to the Apps menu. Trigger the debug mode and update the list by clicking on the "Update Apps List" link. Now install the module by clicking on the install button.
The biggest advantage of this variant is that you can now also update the app using the "pip" command. To do this, enter the following command in your console:
pip install --upgrade --extra-index-url https://nexus.mukit.at/repository/odoo/simple <module>
When the process is finished, restart your server and update the application in Odoo. The steps are the same as for the installation only the button has changed from "Install" to "Upgrade".
You can also view available Apps directly in our repository and find a more detailed installation guide on our website.
For modules licensed under OPL-1, you will receive access data when you purchase the module. If the modules were not purchased directly from MuK IT please contact our support (email@example.com) with a confirmation of purchase to receive the corresponding access data.
To upgrade this module, you need to:
Download the module and add it to your Odoo addons folder. Restart the server and log on to your Odoo server. Select the Apps menu and upgrade the module by clicking on the upgrade button.
If you installed the module using the "pip" command, you can also update the module in the same way. Just type the following command into the console:
pip install --upgrade --extra-index-url https://nexus.mukit.at/repository/odoo/simple <module>
When the process is finished, restart your server and update the application in Odoo, just like you would normally.
In case the module should be active in every database just change the auto install flag to True. To activate the routes even if no database is selected the module should be loaded right at the server start. This can be done by editing the configuration file or passing a load parameter to the start script.
To configure this module, you need to:
- Go to Settings -> Restful API -> Dashboard. Here you can see an overview of all your APIs.
- Click on Create or go to either Restful API -> OAuth1 or Restful API -> OAuth2 to create a new API.
This module provides a set of routes to interact with the system via HTTP requests. Currently it is not possible to send requests with the content type "application/json" due to a limitation of the Odoo framework. Take a look at the clients and examples or open the documentation to get a detailed description of every available route.
- Mathias Markl <firstname.lastname@example.org>
Some pictures are based on or inspired by:
- Font Awesome
MuK Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from MuK IT GmbH. The above permissions are granted for a single database per purchased license. Furthermore, with a valid license it is permitted to use the software on other databases as long as the usage is limited to a testing or development environment. You may develop modules based on the Software or that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the MuK Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module
- The author can leave a single reply to each comment.
- This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
- If you want to start a discussion with the author or have a question related to your purchase, please use the support page.