{ "info": { "author": "ACSONE SA/NV, Odoo Community Association (OCA)", "author_email": "support@odoo-community.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Odoo", "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", "Programming Language :: Python" ], "description": "=========\nBase Rest\n=========\n\n.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n !! This file is generated by oca-gen-addon-readme !!\n !! changes will be overwritten. !!\n !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png\n :target: https://odoo-community.org/page/development-status\n :alt: Beta\n.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png\n :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html\n :alt: License: LGPL-3\n.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Frest--framework-lightgray.png?logo=github\n :target: https://github.com/OCA/rest-framework/tree/12.0/base_rest\n :alt: OCA/rest-framework\n.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png\n :target: https://translation.odoo-community.org/projects/rest-framework-12-0/rest-framework-12-0-base_rest\n :alt: Translate me on Weblate\n.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png\n :target: https://runbot.odoo-community.org/runbot/271/12.0\n :alt: Try me on Runbot\n\n|badge1| |badge2| |badge3| |badge4| |badge5| \n\nThis addon provides the basis to develop high level REST APIs for Odoo.\n\nAs Odoo becomes one of the central pieces of enterprise IT systems, it often\nbecomes necessary to set up specialized service interfaces, so existing\nsystems can interact with Odoo.\n\nWhile the XML-RPC interface of Odoo comes handy in such situations, it\nrequires a deep understanding of Odoo\u2019s internal data model. When used\nextensively, it creates a strong coupling between Odoo internals and client\nsystems, therefore increasing maintenance costs.\n\n**Table of contents**\n\n.. contents::\n :local:\n\nConfiguration\n=============\n\nIf an error occurs when calling a method of a service (ie missing parameter,\n..) the system returns only a general description of the problem without\ndetails. This is done on purpose to ensure maximum opacity on implementation\ndetails and therefore lower security issue.\n\nThis restriction can be problematic when the services are accessed by an\nexternal system in development. To know the details of an error it is indeed\nnecessary to have access to the log of the server. It is not always possible\nto provide this kind of access. That's why you can configure the server to run\nthese services in development mode.\n\nTo run the REST API in development mode you must add a new section\n'**[base_rest]**' with the option '**dev_mode=True**' in the server config\nfile.\n\n.. code-block:: cfg\n\n [base_rest]\n dev_mode=True\n\nWhen the REST API runs in development mode, the original description and a\nstack trace is returned in case of error. **Be careful to not use this mode\nin production**.\n\nUsage\n=====\n\nTo add your own REST service you must provides at least 2 classes.\n\n* A Component providing the business logic of your service,\n* A Controller to register your service.\n\nThe business logic of your service must be implemented into a component\n(``odoo.addons.component.core.Component``) that inherit from\n'base.rest.service'\n\n.. code-block:: python\n\n from odoo.addons.component.core import Component\n\n\n class PingService(Component):\n _inherit = 'base.rest.service'\n _name = 'ping.service'\n _usage = 'ping'\n _collection = 'my_module.services'\n\n\n # The following method are 'public' and can be called from the controller.\n def get(self, _id, message):\n return {\n 'response': 'Get called with message ' + message}\n\n def search(self, message):\n return {\n 'response': 'Search called search with message ' + message}\n\n def update(self, _id, message):\n return {'response': 'PUT called with message ' + message}\n\n # pylint:disable=method-required-super\n def create(self, **params):\n return {'response': 'POST called with message ' + params['message']}\n\n def delete(self, _id):\n return {'response': 'DELETE called with id %s ' % _id}\n\n # Validator\n def _validator_search(self):\n return {'message': {'type': 'string'}}\n\n # Validator\n def _validator_get(self):\n # no parameters by default\n return {}\n\n def _validator_update(self):\n return {'message': {'type': 'string'}}\n\n def _validator_create(self):\n return {'message': {'type': 'string'}}\n\nOnce your have implemented your services (ping, ...), you must tell to Odoo\nhow to access to these services. This process is done by implementing a\ncontroller that inherits from ``odoo.addons.base_rest.controllers.main.RestController``\n\n.. code-block:: python\n\n from odoo.addons.base_rest.controllers import main\n\n class MyRestController(main.RestController):\n _root_path = '/my_services_api/'\n _collection_name = my_module.services\n\nIn your controller, _'root_path' is used to specify the root of the path to\naccess to your services and '_collection_name' is the name of the collection\nproviding the business logic for the requested service/\n\n\nBy inheriting from ``RestController`` the following routes will be registered\nto access to your services\n\n.. code-block:: python\n\n @route([\n ROOT_PATH + '',\n ROOT_PATH + '/search',\n ROOT_PATH + '/',\n ROOT_PATH + '//get'\n ], methods=['GET'], auth=\"user\", csrf=False)\n def get(self, _service_name, _id=None, **params):\n method_name = 'get' if _id else 'search'\n return self._process_method(_service_name, method_name, _id, params)\n\n @route([\n ROOT_PATH + '',\n ROOT_PATH + '/',\n ROOT_PATH + '/',\n ROOT_PATH + '//'\n ], methods=['POST'], auth=\"user\", csrf=False)\n def modify(self, _service_name, _id=None, method_name=None, **params):\n if not method_name:\n method_name = 'update' if _id else 'create'\n if method_name == 'get':\n _logger.error(\"HTTP POST with method name 'get' is not allowed. \"\n \"(service name: %s)\", _service_name)\n raise BadRequest()\n return self._process_method(_service_name, method_name, _id, params)\n\n @route([\n ROOT_PATH + '/',\n ], methods=['PUT'], auth=\"user\", csrf=False)\n def update(self, _service_name, _id, **params):\n return self._process_method(_service_name, 'update', _id, params)\n\n @route([\n ROOT_PATH + '/',\n ], methods=['DELETE'], auth=\"user\", csrf=False)\n def delete(self, _service_name, _id):\n return self._process_method(_service_name, 'delete', _id)\n\n\nThe HTTP GET 'http://my_odoo/my_services_api/ping' will be dispatched to the\nmethod ``PingService.search``\n\nKnown issues / Roadmap\n======================\n\nThe `roadmap `_\nand `known issues `_ can\nbe found on GitHub.\n\nChangelog\n=========\n\n12.0.2.0.1\n~~~~~~~~~~\n\n* _validator_...() methods can now return a cerberus ``Validator`` object\n instead of a schema dictionnary, for additional flexibility (e.g. allowing\n validator options such as ``allow_unknown``).\n\n12.0.2.0.0\n~~~~~~~~~~\n\n* Licence changed from AGPL-3 to LGPL-3\n\n12.0.1.0.1\n~~~~~~~~~~\n\n* Fix issue when rendering the jsonapi documentation if no documentation is\n provided on a method part of the REST api.\n\n12.0.1.0.0\n~~~~~~~~~~\n\nFirst official version. The addon has been incubated into the\n`Shopinvader repository `_ from\nAkretion. For more information you need to look at the git log.\n\nBug Tracker\n===========\n\nBugs are tracked on `GitHub Issues `_.\nIn case of trouble, please check there if your issue has already been reported.\nIf you spotted it first, help us smashing it by providing a detailed and welcomed\n`feedback `_.\n\nDo not contact contributors directly about support or help with technical issues.\n\nCredits\n=======\n\nAuthors\n~~~~~~~\n\n* ACSONE SA/NV\n\nContributors\n~~~~~~~~~~~~\n\n* Laurent Mignon \n* S\u00e9bastien Beau \n\nMaintainers\n~~~~~~~~~~~\n\nThis module is maintained by the OCA.\n\n.. image:: https://odoo-community.org/logo.png\n :alt: Odoo Community Association\n :target: https://odoo-community.org\n\nOCA, or the Odoo Community Association, is a nonprofit organization whose\nmission is to support the collaborative development of Odoo features and\npromote its widespread use.\n\n.. |maintainer-lmignon| image:: https://github.com/lmignon.png?size=40px\n :target: https://github.com/lmignon\n :alt: lmignon\n\nCurrent `maintainer `__:\n\n|maintainer-lmignon| \n\nThis module is part of the `OCA/rest-framework `_ project on GitHub.\n\nYou are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/OCA/rest-framework", "keywords": "", "license": "LGPL-3", "maintainer": "", "maintainer_email": "", "name": "odoo12-addon-base-rest", "package_url": "https://pypi.org/project/odoo12-addon-base-rest/", "platform": "", "project_url": "https://pypi.org/project/odoo12-addon-base-rest/", "project_urls": { "Homepage": "https://github.com/OCA/rest-framework" }, "release_url": "https://pypi.org/project/odoo12-addon-base-rest/12.0.2.0.1/", "requires_dist": [ "cerberus", "odoo12-addon-component", "odoo (<12.1dev,>=12.0a)", "parse-accept-language", "pyquerystring" ], "requires_python": ">=3.5", "summary": "Develop your own high level REST APIs for Odoo thanks to this addon.", "version": "12.0.2.0.1" }, "last_serial": 5993759, "releases": { "12.0.1.0.0.99.dev1": [ { "comment_text": "", "digests": { "md5": "339205d85300d7da78fbb55c1b63738e", "sha256": "974637689650a719b9b430e6d93ad63285fbc6435d9dcf1633fcaad8cd4e2e0d" }, "downloads": -1, "filename": "odoo12_addon_base_rest-12.0.1.0.0.99.dev1-py3-none-any.whl", "has_sig": false, "md5_digest": "339205d85300d7da78fbb55c1b63738e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 2821848, "upload_time": "2018-11-23T05:49:20", "url": "https://files.pythonhosted.org/packages/8c/b9/b388794085f14dd90d40799d73bca79ce36432f927918cb3eb1fffc57014/odoo12_addon_base_rest-12.0.1.0.0.99.dev1-py3-none-any.whl" } ], "12.0.1.0.1.99.dev1": [ { "comment_text": "", "digests": { "md5": "be13a8797365da799a83716b1f23c239", "sha256": "fc8b921ed46ae2596e4cf01b9035f07bc72129cbc895b6e33628d19637e17ef0" }, "downloads": -1, "filename": "odoo12_addon_base_rest-12.0.1.0.1.99.dev1-py3-none-any.whl", "has_sig": false, "md5_digest": "be13a8797365da799a83716b1f23c239", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 2822084, "upload_time": "2018-12-11T05:49:59", "url": "https://files.pythonhosted.org/packages/b3/31/efae0085b332c5a504f27ff5fecb37c71ac6ed30870faaf19c37a0ca55ad/odoo12_addon_base_rest-12.0.1.0.1.99.dev1-py3-none-any.whl" } ], "12.0.2.0.0": [ { "comment_text": "", "digests": { "md5": "20e39521bd41de8a7263b4a5cefa2266", "sha256": "0102d80055e792499dfbaffe08a99c9730b3b34700ecbac2dd78eeaf037b8cb3" }, "downloads": -1, "filename": "odoo12_addon_base_rest-12.0.2.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "20e39521bd41de8a7263b4a5cefa2266", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 2822118, "upload_time": "2019-06-18T04:58:24", "url": "https://files.pythonhosted.org/packages/95/56/3669dd1cbbeb2ce23a789cf029faeaa41391b790ebe37adfe5c0a1e6a82c/odoo12_addon_base_rest-12.0.2.0.0-py3-none-any.whl" } ], "12.0.2.0.0.99.dev1": [ { "comment_text": "", "digests": { "md5": "0e2c3c59079fa44913ecd4e53ebf7704", "sha256": "9fe0f51d10c127a0beeac7588afbcca7df78a7ab0b46a2c43e24f369c74ff95d" }, "downloads": -1, "filename": "odoo12_addon_base_rest-12.0.2.0.0.99.dev1-py3-none-any.whl", "has_sig": false, "md5_digest": "0e2c3c59079fa44913ecd4e53ebf7704", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 2822196, "upload_time": "2019-07-30T05:33:17", "url": "https://files.pythonhosted.org/packages/b9/ee/f160bca3f751e1ba8913c78f4da4b9c267fb93d66f9160bd0fbcb7283254/odoo12_addon_base_rest-12.0.2.0.0.99.dev1-py3-none-any.whl" } ], "12.0.2.0.1": [ { "comment_text": "", "digests": { "md5": "873bf15d2098d01c512f33f75ba1321a", "sha256": "075730c0856108bda033cc85b958512b93ba34fd7b1949eb1998c050d7a451cf" }, "downloads": -1, "filename": "odoo12_addon_base_rest-12.0.2.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "873bf15d2098d01c512f33f75ba1321a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 2822613, "upload_time": "2019-08-03T05:03:39", "url": "https://files.pythonhosted.org/packages/78/1d/52d6f8c1a7c3c8b7dce2be57da3246099e0684bc6446a8c5b33ebd39abc3/odoo12_addon_base_rest-12.0.2.0.1-py3-none-any.whl" } ], "12.0.2.0.1.99.dev1": [ { "comment_text": "", "digests": { "md5": "e67c113813ad4bd980bb0362a9dd9149", "sha256": "d5cda291e7b808b5f94d0c20b5f890c1ef724661363a5f58a5bb20740f7b1324" }, "downloads": -1, "filename": "odoo12_addon_base_rest-12.0.2.0.1.99.dev1-py3-none-any.whl", "has_sig": false, "md5_digest": "e67c113813ad4bd980bb0362a9dd9149", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 2826866, "upload_time": "2019-08-29T05:04:21", "url": "https://files.pythonhosted.org/packages/72/10/ad55784f3b3d13ff7b30ade234fc80cec0740a081b22cae5f3b21874e122/odoo12_addon_base_rest-12.0.2.0.1.99.dev1-py3-none-any.whl" } ], "12.0.2.0.1.99.dev2": [ { "comment_text": "", "digests": { "md5": "659f745842b7354e439e0253ac650891", "sha256": "2896752546759b5d77be9e3cffb9ded6348c107b5fa1fe9b39d300c707808d85" }, "downloads": -1, "filename": "odoo12_addon_base_rest-12.0.2.0.1.99.dev2-py3-none-any.whl", "has_sig": false, "md5_digest": "659f745842b7354e439e0253ac650891", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 2826884, "upload_time": "2019-10-18T05:07:09", "url": "https://files.pythonhosted.org/packages/51/0c/40eb713999cecaf6d809db390a8eb979ecb23f8ef63c62dc3ee016b0f616/odoo12_addon_base_rest-12.0.2.0.1.99.dev2-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "873bf15d2098d01c512f33f75ba1321a", "sha256": "075730c0856108bda033cc85b958512b93ba34fd7b1949eb1998c050d7a451cf" }, "downloads": -1, "filename": "odoo12_addon_base_rest-12.0.2.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "873bf15d2098d01c512f33f75ba1321a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 2822613, "upload_time": "2019-08-03T05:03:39", "url": "https://files.pythonhosted.org/packages/78/1d/52d6f8c1a7c3c8b7dce2be57da3246099e0684bc6446a8c5b33ebd39abc3/odoo12_addon_base_rest-12.0.2.0.1-py3-none-any.whl" } ] }