You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The body must be a json-object containing the arguments for the model's method. Both ``ids`` and
41
105
``context`` are special arguments: they are used to craft the environment and recordset on which the
42
106
method is executed.
43
107
44
-
The headers ``Host``, ``Authorization`` (bearer + api key) and ``Content-Type`` are required. The
108
+
The headers ``Host``, ``Authorization`` with an API key and ``Content-Type`` are required. The
45
109
``X-Odoo-Database`` header is only necessary when multiple databases are hosted behind a same
46
110
``Host``. A ``User-Agent`` with the name of the software where the request comes from is
47
111
recommended.
@@ -67,7 +131,6 @@ A **200 OK** status with the method's return value serialized as json in the bod
67
131
{"id": 25, "name": "Deco Addict"}
68
132
]
69
133
70
-
71
134
Error
72
135
-----
73
136
@@ -84,19 +147,6 @@ A **4xx**/**5xx** status with the error message serialized as a json string in t
84
147
The complete traceback is available in the server log, at the same date as the error response.
85
148
86
149
87
-
88
-
Database
89
-
========
90
-
91
-
Depending on the deploiement, the ``Host`` and/or ``X-Odoo-Database`` request headers might be
92
-
required. The ``Host`` header is required on servers where Odoo is installed next to other web
93
-
applications, so a web-server/reverse-proxy is able to route the request to the Odoo server. The
94
-
``X-Odoo-Database`` header is required when a single Odoo server hosts multiple databases, and that
95
-
:ref:`dbfilter` wasn't configured to use the ``Host`` header.
96
-
97
-
Most HTTP client libraries automatically set the ``Host`` header using the connection url.
98
-
99
-
100
150
API Key
101
151
=======
102
152
@@ -119,13 +169,14 @@ Create a new API key for a user via :guilabel:`Preferences`, :guilabel:`Account
119
169
120
170
A description and a duration are needed to create a new api key. The description makes it possible
121
171
to identify the key, and to determine later whether the key is still in use or should be removed.
122
-
It should be as clear and complete as possible. The duration determines the lifetime of the key
123
-
after which the the key becomes invalid. It is recommended to set a short duration (typically 1 day)
124
-
for interactive usage. It is not possible to create keys that last for more than 3 months, it means
125
-
that long lasting keys must be rotated at least once every 3 months.
172
+
The duration determines the lifetime of the key after which the the key becomes invalid. It is
173
+
recommended to set a short duration (typically 1 day) for interactive usage. It is not possible to
174
+
create keys that last for more than 3 months, it means that long lasting keys must be rotated at
175
+
least once every 3 months.
126
176
127
-
The :guilabel:`Generate Key` creates a 20 bytes (160 bits) strong random key. Its value appears on
128
-
screen, this is the only time and place the key is visible on screen, it must be copied, kept secret and stored somewhere secure. If it ever gets compromized or lost, then it must be removed.
177
+
The :guilabel:`Generate Key` creates a 160 bits strong random key. Its value appears on screen, this
178
+
is the only time and place the key is visible on screen. It must be copied, kept secret and stored
179
+
somewhere secure. If it ever gets compromized or lost, then it must be removed.
129
180
130
181
Please refer to OWASP's `Secrets Management Cheat Sheet`_ for further guidance on the management of
131
182
API keys.
@@ -137,8 +188,7 @@ Access Rights
137
188
=============
138
189
139
190
The JSON-2 API uses the standard :ref:`security <reference/security>` model of Odoo. All operations
140
-
are validated against the access rights, record rules and field accesses granted to the current
141
-
user. The current user is used as well for the :ref:`reference/fields/automatic/log_access`.
191
+
are validated against the access rights, record rules and field accesses of the user.
142
192
143
193
For **interfactive usage**, such as discovering the API or running one-time scripts, it is fine to
144
194
use a **personal account**.
@@ -151,12 +201,23 @@ Using dedicated bot users has several benefits:
151
201
* The minimum required permissions can be granted to the bot, limiting the impact may the API key
152
202
gets compromised;
153
203
* The password can be set empty to disable login/password authentication, limiting the likelihood
154
-
the account get compromized;
155
-
* The :ref:`reference/fields/automatic/log_access` use the bot account. No internal user gets
156
-
impersonalized.
204
+
the account gets compromized;
205
+
* The :ref:`reference/fields/automatic/log_access` use the bot account. No user gets impersonalized.
206
+
207
+
208
+
Database
209
+
========
210
+
211
+
Depending on the deploiement, the ``Host`` and/or ``X-Odoo-Database`` request headers might be
212
+
required. The ``Host`` header is required on servers where Odoo is installed next to other web
213
+
applications, so a web-server/reverse-proxy is able to route the request to the Odoo server. The
214
+
``X-Odoo-Database`` header is required when a single Odoo server hosts multiple databases, and that
215
+
:ref:`dbfilter` wasn't configured to use the ``Host`` header.
216
+
217
+
Most HTTP client libraries automatically set the ``Host`` header using the connection url.
0 commit comments