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!
This question has been flagged
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!
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up| Related Posts | Replies | Views | Activity | |
|---|---|---|---|---|
|
|
0
Apr 26
|
7 | ||
|
|
3
Oct 25
|
3700 | ||
|
|
2
Dec 24
|
5364 | ||
|
|
0
Oct 23
|
4858 | ||
|
|
1
Feb 22
|
6512 |
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