List Records
Records can be listed and filtered via search(). It takes a mandatory domain filter (possibly empty) and returns the database identifiers of all records matching the filter.
GET /restapi/1.0/object/{object_name}
Request:
GET /restapi/1.0/object/res.partner/search?domain=[('is_company','=',True),('customer','=',True)] HTTP/1.1
Host: {your_Odoo_server_url}
JSON Response:
HTTP/1.1 200 OK
{
'Partner': [
7, 18, 12, 10, 17, 19, 8, 31, 26, 16, 13, 20, 30, 22, 29, 15, 23, 28, 74
]
}
XML Response:
HTTP/1.1 200 OK
<res.partner type="list">
<item type="int">7</item>
<item type="int">18</item>
<item type="int">12</item>
<item type="int">10</item>
<item type="int">17</item>
<item type="int">19</item>
<item type="int">8</item>
<item type="int">31</item>
<item type="int">26</item>
<item type="int">16</item>
<item type="int">13</item>
<item type="int">20</item>
<item type="int">30</item>
<item type="int">22</item>
<item type="int">29</item>
<item type="int">15</item>
<item type="int">23</item>
<item type="int">28</item>
<item type="int">74</item>
</res.partner>
Query Parameters:
domain – A search domain. Use an empty list to match all records.
offset – OPTIONAL. Number of results to ignore (default: none)
limit – OPTIONAL. Maximum number of records to return (default: all)
order – OPTIONAL. Sort string
count – OPTIONAL. if True, only counts and returns the number of matching records (default: False)
Request Headers
Accept – the response content type depends on Accept header
Authorization – The OAuth protocol parameters to authenticate.
Response Headers
Content-Type – this depends on Accept header of the request
Status Codes
200 OK – no error
404 Not Found – there’s no resource
401 Unauthorized – authentication failed
403 Forbidden – if any error raise
Last updated