Skip to main content

Beta License: AGPL-3 coopdevs/som-connexio/odoo-somconnexio

This module builds a REST API controller base, to build endpoints on them in the somconnexio application modules.

Table of contents

Configuration

Create a API key with a user related with the needed security rights to read and modify contracts.

You can follow the next instruccions:

  • Settings > Technical (debug mode) > Auth API Key

  • click create and select a user, save.

  • communicate the API-KEY to the client or app to use the API.

Usage

Two controllers with two collections are set: - APIKeyController, with an api-key authentication. Collection: “sc.api.key.services” - PublicController, for endpoints with no authentication required. Collection: “sc.public.services”

To use them, create service with a Component class using one of these collections.

class PingPublicAPIService(Component):
    _name = "ping.public.api.service"    # name for the new component
    _inherit = "base.rest.service"       # always inherit from base.rest.service (se base_rest module)
    _collection = "sc.public.services"   # collection to use
    _usage = "ping"  # service_name      # collection path
    _description = """
        Ping services (test the public api)
    """

The collection used will inherit its related Controller _root_path and auth method for the given Component The final endpoint will be formed by the Controller _root_path plus the Component usage plus its child endponts defined in their methods. Example: “/public-api/ping/create”

You can see the PingAuthAPIService or PingPublicAPIService services, left as model references.

Also, a “common_service” test class is created for tests purposes. Tests classes using endpoints can inherit from it to use its API call methods.

Contributors

Metadata

Release files for odoo-addon-base-rest-somconnexio 16.0.1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for odoo-addon-base-rest-somconnexio 16.0.1.0.1
File Size Uploaded
odoo_addon_base_rest_somconnexio-16.0.1.0.1.tar.gz 8.1 kB Details

Release files / odoo_addon_base_rest_somconnexio-16.0.1.0.1.tar.gz

Download URL odoo_addon_base_rest_somconnexio-16.0.1.0.1.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
58cc3456e88cf95923f0548724da3684f9ab0230dbfb979df406e33a73992d2a
BLAKE2b-256 checksum
How to use checksums
b4c7b79fa67b29026cc5f217f8c5b7e2fdb1c52cb78da9391d7905f18be2a602
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

16.0.1.0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page