Base Rest Datamodel

Base Rest Datamodel

by Contaura LLC · original work by ACSONE SA/NV, OCA
base_rest_datamodel
$ 29.00

Datamodel binding for base_rest

1.0
Needs 3 more store apps, added with it: Total $ 216.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 namebase_rest_datamodel
Module version12.0.3.0.1
Tulio versions1.0
CategoryTools
PublisherContaura LLC
Ported to Tulio, tested and supported by Contaura LLC.
Original authorsACSONE SA/NV, OCA
LicenseLGPL-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 librariesapispec, marshmallow
Install them on the server with pip before installing the module.
Requires (store) Base Rest, Datamodel
Lines of code92
Downloads0
Released12/06/2026
12.0.3.0.1 Tulio 1.0 · 12/06/2026