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!
Pertanyaan ini telah diberikan tanda
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!
Menikmati diskusi? Jangan hanya membaca, ikuti!
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
Daftar| Post Terkait | Replies | Tampilan | Aktivitas | |
|---|---|---|---|---|
|
|
0
Jul 26
|
12 | ||
|
|
3
Okt 25
|
4110 | ||
|
|
2
Des 24
|
5672 | ||
|
|
0
Okt 23
|
5122 | ||
|
|
1
Feb 22
|
6834 |
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