Odoo Help

Welcome!

This community 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.

0

Update product using REST API (JSON-RPC) ?

By
Tillt
on 4/27/14, 9:01 PM 11,998 views

Hello,

I'm trying to update a product but I can't find the correct JSON structure to do it. Here is what I've tried:

{
    "jsonrpc": "2.0",
    "method": "call",
    "params": {
        "model": "product.product",
        "ids": [
            77
        ],
        "vals": {
            "name_template": "Coca-Cola 50cl OK"
        },
        "context": {},
        "session_id": "f48b00a031fc4920af0b3e4ec04d9497"
    },
    "id": "r6"
}

on this URL: /web/dataset/write

All my "search_read" requests are working normaly but I need your help for the "write" one.

Could you help me?

-- Edit ----------

When I enabled the debug-rpc log level I can see that:

2014-04-28 19:58:13,507 7104 INFO ? werkzeug: 127.0.0.1 - - [28/Apr/2014 19:58:13] "POST /web/dataset/write HTTP/1.1" 404 -

The URL for write data seems to be false... Does someone knows it ?

-- Edit ----------

I've tried to edit my product through OpenERP web interface to see the log...

2014-04-28 20:26:50,864 7104 DEBUG database openerp.netsvc.rpc.request: object.execute_kw time:0.373s mem: 49368k -> 49452k (diff: 84k)(u'database', 1, '*', u'product.product', 'write', (...), {...})
2014-04-28 20:26:51,012 7104 INFO database werkzeug: 127.0.0.1 - - [28/Apr/2014 20:26:51] "POST /web/dataset/call_kw HTTP/1.1" 200 -

It seems send the request at /web/dataset/call_kw so when I send my request to this URL I receive this answer:

2014-04-28 20:52:41,036 7104 ERROR database openerp.addons.web.http.JSONRequest.dispatch: An error occured while handling a json request
Traceback (most recent call last):
  File "C:\Program Files (x86)\OpenERP 7.0\Server\server\openerp\addons\web\http.py", line 204, in dispatch
TypeError: call_kw() got an unexpected keyword argument 'vals'
2014-04-28 20:52:41,184 7104 INFO database werkzeug: 127.0.0.1 - - [28/Apr/2014 20:52:41] "POST /web/dataset/call_kw HTTP/1.1" 200 -

An idea to solve my problem ?

Thanks.

Same problem..... Do you get any solution????

Gaurav Sahu
on 9/9/14, 7:06 AM

Same problem..... Do you get any solution????

Gaurav Sahu
on 9/9/14, 7:06 AM

hii i solve this prob... You are passing wrong string follow this link http://gauravsahu.github.io/odoo-client-JSON-RPC/

Gaurav Sahu
on 10/3/14, 9:06 AM
2
Gaurav Sahu
On 10/3/14, 9:20 AM

hii

i solved this prob...

You are passing wrong string

follow this link
http://gauravsahu.github.io/odoo-client-JSON-RPC/

0
Andreas Jonderko
On 10/14/14, 4:48 PM

You have to use the url for all your requests, follow the examples of Gaurav Sahu.

http://%s:%s/jsonrpc

In this file you will find more answers of possible calls: Odoo 8.0 (on Ubuntu 14.04) /usr/lib/python2.7/dist-packages/openerp/http.py

 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 4/27/14, 9:01 PM
Seen: 11998 times
Last updated: 6/9/15, 4:56 AM