Tryton provides a way to connect URL rules to an callable endpoint using the
route of the
trytond.wsgi.app instance. This
allows you to define a custom API based on HTTP that can be used to create a
specific user application.
The decorator takes as first parameter a string which follow the Rule Format of Werkzeug and as second parameter sequence of HTTP methods.
from trytond.wsgi import app
return 'Hello world'
The following converter is added by Tryton:
This converter accepts any Base64 string and transforms it into its corresponding bytes value.
Tryton also provides some wrappers in
trytond.protocols.wrappers to ease the
creation of such route.
Change the default limit of the request to the size in bytes.
Allow requests which have their
Take the first parameter as database name and replace it by the corresponding instance of the Pool.
Authorizationheader using the type
bearerand a valid key for the named user application.
User Application Key¶
Tryton also provides a easy way to manage access to user application using
keys per named application.
A key is created with a
POST request on the
/<database_name>/user/application/ which returns the key. The request must
contain as data a JSON object with the keys:
The user login.
The name of the application.
After the creation, the key must be validated by the user from the preferences of a Tryton client.
A key can be deleted with a
DELETE request on the same
URL. The request
must contain as data a JSON object with the keys:
The user login.
The key to delete.
The name of the application of the key.