تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
3138 أدوات العرض

I'm try to filter the fields I want in the response, but always get error.


I'm using Postmant.

The request without fetch fields works perfect.

request

Method: POST

Url:  http://:8069/jsonrpc/

Body: 

​ {

​"jsonrpc": "2.0",

​"method": "call",

​"params": {

​"service": "object",

​"method": "execute",

​"args": ["{{database}}", {{userId}}, "{{apiKey}}", "res.users", "search_read", [], []]}

}

 {database}}, {{userId}}, {{apiKey}} are variables from Postman


The request with fetch fields I`m trying

Method: POST

Url:  http://:8069/jsonrpc/

Body: 

​ {

​"jsonrpc": "2.0",

​"method": "call",

​"params": {

​"service": "object",

​"method": "execute",

​ "args": ["{{database}}", {{userId}}, "{{apiKey}}", "res.users", "search_read", [], {"fields": ["login", "active"]}]}

}


The error:  "Invalid field 'fields' on model 'res.users'"


Can someone help me?



الصورة الرمزية
إهمال
الكاتب أفضل إجابة

thanks,

it works

I thought I had tried it before but anyway, thank you very much

الصورة الرمزية
إهمال
أفضل إجابة

Hi,

The field names are supposed to be a list 
So try it like this

{
    "jsonrpc": "2.0",

    "method": "call",

    "params": {

        
        "service": "object",

        "method": "execute",

        "args": ["{{database}}", {
                {
                    userId
                }
            }, "{{apiKey}}", "res.users", "search_read", [],
            ["login", "active"]
        ]
    }

}

Hope it helps

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
يناير 24
7936
0
سبتمبر 22
2633
0
أبريل 24
1474
0
فبراير 24
577
0
أكتوبر 22
7176