$ 29.00
Datamodel binding for base_rest
Needs 3 more store apps, added with it:
- Base Rest · $ 79.00
- Datamodel · $ 29.00
- Components · $ 79.00
One purchase covers every version. Already bought it? Sign in.
Base Rest Datamodel
This addon allows you to use DataModel objects as params and/or response with your REST API methods.
Table of contents
Usage
To use DataModel instances as request and/or response of a REST service endpoint you must:
- Define your DataModel objects;
- Provides the information required to the tulio.addons.base_rest.restapi.method decorator;
from marshmallow import fields from tulio.addons.base_rest import restapi from tulio.addons.component.core import Component from tulio.addons.datamodel.core import Datamodel class PingMessage(Datamodel): _name = "ping.message" message = fields.String(required=True, allow_none=False) class PingService(Component): _inherit = 'base.rest.service' _name = 'ping.service' _usage = 'ping' _collection = 'my_module.services' @restapi.method( [(["/pong"], "GET")], input_param=restapi.Datamodel("ping.message"), output_param=restapi.Datamodel("ping.message"), auth="public", ) def pong(self, ping_message): PingMessage = self.env.datamodels["ping.message"] return PingMessage(message = "Received: " + ping_message.message)
| Technical name | base_rest_datamodel |
|---|---|
| Module version | 12.0.3.0.1 |
| Tulio versions | 1.0 |
| Category | Tools |
| Publisher | Contaura LLC
Ported to Tulio, tested and supported by Contaura LLC. |
| Original authors | ACSONE SA/NV, OCA |
| License | LGPL-3
Open source: you may use, change and share
this module under its license. The price covers the Tulio port, its testing on Tulio
1.0 and the download. |
| Python libraries | apispec, marshmallow
Install them on the server with pip before installing the module. |
| Requires (store) | Base Rest, Datamodel |
| Lines of code | 92 |
| Downloads | 0 |
| Released | 12/06/2026 |