Odoo Help


Web API login works, but requesting data doesn't

Vincent van Steenes
on 6/23/14, 8:46 AM 1,687 views

I'm having some trouble requesting data through the web API. What works is logging in. I log in by requesting /web/session/authenticate and I get a session id in return. With this session id I would like to request some data.

I try requesting the data through /web/dataset/search_read given the following parameters:

[content] => {"jsonrpc":"2.0","method":"call","id":"<ID_GOES_HERE>","params":{"model":"product.product","domain":[],"fields":["price"],"session_id":"<SESSION_ID_GOES_HERE>"}}
[header] => Content-Type: application/json
Connection: Close
Cookie: session_id=<SESSION_ID_GOES_HERE>; Expires=Sun, 21-Sep-2014 11:59:02 GMT; Max-Age=7776000; Path=/
[method] => POST
[timeout] => 5

In the return headers of the search request is a HTTP/1.1 403 FORBIDDEN.

Ofcourse, the session id I send with the request is the same as I get in return from the server when I log in. Also, when i request /web/session/get_session_info, I get this in return with the correct session id:

{"jsonrpc": "2.0", "id": "<ID_GOES_HERE>", "result": {"username": "<USERNAME_GOES_HERE>", "user_context": {}, "db": "<DB_GOES_HERE>", "uid": false, "session_id": "<SESSION_ID_GOES_HERE>"}}

I notice that user_context is empty and the uid is false. Can anyone tell me if I'm doing something wrong? I'm using the online version of Odoo.


Ludo - 21South

--Ludo - 21South--
| 2 2 5
Zwijndrecht, Netherlands
--Ludo - 21South--


Ludo - 21South
On 6/23/14, 9:15 AM

I have never used the web API this way so I don't know anything about that, but what I can tell you is that almost every function of the ORM in Odoo uses the UID to determine if a user is able to perform said function. 

Are you able to manually provide a uid? You can use the admin's uid for testing purposes (this is usually id 1). 

Also, check if the call for search_read is already implemented. I have tried it recently and found it not to be working (although it was in the docs). Try a simple search first and see if you get any results.. 

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/23/14, 8:46 AM
Seen: 1687 times
Last updated: 3/16/15, 8:10 AM