Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
2936 Vistas

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?



Avatar
Descartar
Autor Mejor respuesta

thanks,

it works

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

Avatar
Descartar
Mejor respuesta

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

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
ene 24
7512
0
sept 22
2551
0
abr 24
1380
0
feb 24
514
0
oct 22
7070