Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

Info

Oregional Odoo RestAPI endpoint: /orestapi/record/name_search

Search for records of a model by display_name


Tip

https://www.odoo.com/documentation/11.0/reference/orm.html


Table of Contents



Request

Code Block
languagebash
themeEmacs
titleSample request
linenumberstrue
curl -v -i -k -H "Authorization: Bearer vWRXap0Iyojs8hxNO9IQKeWRLFpyhGfU" -X GET -d "model=res.partner" -d "name=Web" https://odoo.dev.oregional.hu/orestapi/record/name_search


ItemDescriptionNotes
endpoint/orestapi/record/name_search
typeGET
Header
Authorization

Bearer access_token

Info: oRestAPI See ORESTAPI authorization header

Params
model

model name (eg: res.partner, crm.lead, account.invoice, etc)

  • string
  • mandatory

name

the string to search for

  • string
  • optional

offset

which chunk of the result should be returned

  • integer
  • optional
eg: if offset is 40, than results between 41-60 will be returned
order

how to order the results

  • string
  • optional
  • default: last_modification

follows Odoo domain conventions, so:

  • default result ordering is ascending, you need to specify only if you want descending order, eg: "name desc"
  • multiple ordering can be given, eg: "name desc, assignee, id"
limit

how many results should be returned

  • integer
  • optional
  • default: 20




Response

Code Block
languagebash
themeMidnight
titleSample response
linenumberstrue
[{"header": {{"model": "res.partner", "action_id": 121, "menu_id": 91, "count": 4, "offset": 0, "limit": 20}}, {"data": [{"id": 13, "name": "Camptocamp"}, {"id": 31, "name": "Camptocamp, Ayaan Agarwal"}, {"id": 37, "name": "Camptocamp, Benjamin Flores"}, {"id": 30, "name": "Camptocamp, Phillipp Miller"}]}]


ParentKeyValue TypeDescriptionNotes
headerparent element with generic info about the resultset

modelmodelmodel name

action_idintegeraction id to be used for URL generation

An action (ir.actions.act_window) id for the model, integer, eg: 45


menu_idintegermenu id to be used for URL generation

A menu (ir.ui.menu) id for the model, integer, eg: 312


countintegercount of total results

offsetintegernumber of results to ignore (default: 0)

limitintegermaximum number of records to return (default: 20)
data

parent element for the list of records


idintegerthe id of the record (eg: 1, 413, 4356, etc)The id of the record in the database, eg: 1, 413, 4356, etc

display_namestringthe display_name of the record (eg: John Doe, etc)The value of the record's display_name as defined by the model's name_get function, eg: "INVOICE/2018/314", "John Doe", "Confluence DC sales opportunity for BigCompany"