Skip to Content
Menu
This question has been flagged
2 Replies
8034 Views

I use a set of JSON-RPC queries.

With version 7, the process is okay : -i retrieve the cookie (name "sid")
-web/session/get_session_info
-web/session/authenticate (i send to OpenERP the username, the password, the cookie)

But with version 8, it seems to have changed -i retrieve the cookie (name has changed to "session_id")
-web/session/get_session_info
-but then no "web/session/authenticate"

My question is : how to manage the authentification process in JSON queries in version 8 ? The whole process has changed or I'm doing something wrong ?

How to send to OpenERP, via JSON-RPC, the username and password ?

Avatar
Discard
Author

After some work, here are the changes.

web/session/authenticate,this address that i can not vist on V8, error info:OpenERPJSONRPCClientMethodNotFoundError: http://localhost:8069/web/session/authenticate is not a valid URL.

Author Best Answer

OK, my problem is solved.

Here are the changes, between version 7 and 8.

1-the name of the cookie
V7 = "sid"
V8 = "session_id"

2-in the JSON queries
V7 = need to put "session_id":"xxxxxxxxxxxxxxxxxxxxx"
V8 = no need

Example :
{"jsonrpc":"2.0","method":"call","params":{"model":"res.partner","fields":["name","ref","credit_limit","fax","sale_warn","sale_warn_msg","property_product_pricelist","property_payment_term","sale_order_count","phone","email","country_id"],"domain":[["customer","=",1],["is_company","=",1],["display_name","ilike","AGR"]],"context":{"lang":"fr_FR","tz":"Europe/Brussels","uid":1,"search_default_customer":1,"bin_size":true},"offset":0,"limit":80,"sort":"","session_id":"1bc3ee4bdbbf432f88b38313c4d35ae2"},"id":791668276}

3-the mechanism
V7=need to set the cookie, with the value (retrieved from the header) and not the session_id (sent by OpenERP, after authentification)
V8=both are identical

Last but not least : "web/session/authenticate" is working fine V8. I made a mistake.

Avatar
Discard

what do you mean by: retrieved from the header ? do you think it's possible to associate the session_id with an URL so that tue user can connect automaticly to Openerp v7

Best Answer

v7:

server_response = requests.post('http://localhost:8069/web/session/get_session_info', json.dumps(post_data), cookies=self._cookies)

server_response.status_code=200

server_response.json() is no problem

v8:

server_response.status_code=500 

server_response.json() is error

 

what changes i do that make me can use server_response.json() in v8?

 

Avatar
Discard
Related Posts Replies Views Activity
0
Jan 21
11393
1
Apr 17
10832
2
May 15
5952
0
Mar 15
4542
4
Jan 24
37092