Hello everyone, I am seeking assistance with integrating odoo 18, odoo 19 Odoo's API with a React Native Expo application.Is it possible to establish this connection? If so, could someone please provide a detailed example of how to achieve this integration? Thank you in advance for your help!
Этот вопрос был отмечен
Yes, Odoo 18 and Odoo 19 can be integrated with a React Native Expo application using Odoo's JSON-RPC API.
A common approach is to authenticate the user and then call Odoo models using the /web/session/authenticate and /web/dataset/call_kw endpoints.
Example authentication request:
const response = await fetch(
"https://your-odoo-instance.com/web/session/authenticate",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
params: {
db: "your_database",
login: "user@example.com",
password: "your_password",
},
}),
}
);
const result = await response.json();
Reading records from Odoo:
const response = await fetch(
"https://your-odoo-instance.com/web/dataset/call_kw",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
credentials: "include",
body: JSON.stringify({
jsonrpc: "2.0",
method: "call",
params: {
model: "res.partner",
method: "search_read",
args: [[]],
kwargs: {
fields: ["name", "email"],
limit: 10,
},
},
}),
}
);
const partners = await response.json();
The same approach can be used for create, write, unlink, and custom model methods by changing the method name in call_kw.
For production deployments, avoid storing Odoo user credentials directly in the mobile application. A common practice is to create a custom controller in Odoo that exposes only the required endpoints and handles authentication securely.
Hope that helps!
Не оставайтесь в стороне – присоединяйтесь к обсуждению!
Создайте аккаунт сегодня, чтобы получить доступ к эксклюзивным функциям и стать частью нашего замечательного сообщества!
Регистрация| Похожие посты | Ответы | Просмотры | Активность | |
|---|---|---|---|---|
|
|
0
апр. 26
|
7 | ||
|
|
3
окт. 25
|
3472 | ||
|
|
2
дек. 24
|
5137 | ||
|
|
0
окт. 23
|
4635 | ||
|
|
1
февр. 22
|
6214 |
Hello,
Please review this:
https://www.odoo.com/documentation/18.0/developer/reference/external_api.html
So what do you want to know?
Thank you, but is not explain detail