# Read Filter Records

Record data is accessible via the `search_read()` (shortcut which as its name suggests is equivalent to a [search()](https://www.odoo.com/documentation/16.0/developer/reference/backend/orm.html?highlight=search_count#odoo.models.Model.search_count) followed by a [read()](https://www.odoo.com/documentation/16.0/developer/reference/backend/orm.html#odoo.models.Model.read), but avoids having to perform two requests and keep ids around).

It takes similar arguments of [search()](https://www.odoo.com/documentation/16.0/developer/reference/backend/orm.html#odoo.models.Model.search) and optionally a list of fields to fetch. By default, it will fetch all the records and relevant fields the current user can read, which tends to be a huge amount.

**`GET /restapi/1.0/object/{object_name}/?domain={comma_separated_list_of_args}`**

**Request:**

```
GET /restapi/1.0/object/res.partner?domain=[('is_company','=',True),('customer','=',True)] HTTP/1.1
Host: {your_Odoo_server_url}
```

**JSON Response:**

```
HTTP/1.1 200 OK

{
  'Partner': [
      {
          'id': 12,
          'name': 'Think Big Systems',
          'street': '89 Lingfield Tower',
          'street2': false,
          'city': 'London',
          'state_id': false,
          'zip': false,
          'country_id': [486, 'United Kingdom'],
          'create_date': '2017-07-10 11:02:57',
          'create_uid': [1, 'Administrator'],
          'write_date': '2017-07-11 15:08:45',
          'write_uid': [1, 'Administrator'],
          ...
          ...
          ...
      },
      {
          'id': 17,
          'name': 'Edward Foster',
          'street': '69 rue de Namur',
          'street2': false,
          'city': 'Wavre',
          'state_id': false,
          'zip': '1300',
          'country_id': [274, 'Belgium'],
          'create_date': '2017-07-04 18:10:31',
          'create_uid': [1, 'Administrator'],
          'write_date': '2017-07-04 19:02:59',
          'write_uid': [1, 'Administrator'],
          ...
          ...
          ...
      },
      ...
      ...
      ...
  ]
}
```

**XML Response:**

```
HTTP/1.1 200 OK

<res.partner type="list">
	<item type="dict">
		<id type="int">12</id>
		<name type="str">Think Big Systems</name>
		<street type="str">89 Lingfield Tower</street>
		<street2 type="bool">false</street2>
		<city type="str">London</city>
		<state_id type="bool">false</state_id>
		<zip type="bool">false</zip>
		<country_id type="list">
			<item type="int">486</item>
			<item type="str">United Kingdom</item>
		</country_id>
		<create_date type="str">2017-07-10 11:02:57</create_date>
		<create_uid type="list">
			<item type="int">1</item>
			<item type="str">Administrator</item>
		</create_uid>
		<write_date type="str">2017-07-10 15:02:57</write_date>
		<write_uid type="list">
			<item type="int">1</item>
			<item type="str">Administrator</item>
		</write_uid>
	</item>
	<item type="dict">
		<id type="int">17</id>
		<name type="str">Edward Foster</name>
		<street type="str">69 rue de Namur</street>
		<street2 type="bool">false</street2>
		<city type="str">Wavre</city>
		<state_id type="bool">false</state_id>
		<zip type="str">1300</zip>
		<country_id type="list">
			<item type="int">274</item>
			<item type="str">Belgium</item>
		</country_id>
		<create_date type="str">2017-07-10 11:02:57</create_date>
		<create_uid type="list">
			<item type="int">1</item>
			<item type="str">Administrator</item>
		</create_uid>
		<write_date type="str">2017-07-10 15:02:57</write_date>
		<write_uid type="list">
			<item type="int">1</item>
			<item type="str">Administrator</item>
		</write_uid>
	</item>
</res.partner>
```

**Query Parameters:**

* **domain** – OPTIONAL. A [search domain](https://www.odoo.com/documentation/16.0/developer/reference/backend/orm.html#reference-orm-domains). Use an empty list to match all records.
* **fields** – OPTIONAL. list of field names to return (default is all fields).
* **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)

| Headers and Status Codes | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Request Headers          | <ul><li><a href="https://www.rfc-editor.org/rfc/rfc9110.html#name-accept">Accept</a> – the response content type depends on <em>Accept</em> header</li><li><a href="https://www.rfc-editor.org/rfc/rfc9110.html#name-authorization">Authorization</a> – The OAuth protocol parameters to authenticate.</li></ul>                                                                                                                                                                            |
| Response Headers         | <ul><li><a href="https://www.rfc-editor.org/rfc/rfc9110.html#name-content-type">Content-Type</a> – this depends on <em>Accept</em> header of the request</li></ul>                                                                                                                                                                                                                                                                                                                          |
| Status Codes             | <ul><li><a href="https://www.rfc-editor.org/rfc/rfc9110.html#name-200-ok">200 OK</a> – no error</li><li><a href="https://www.rfc-editor.org/rfc/rfc9110.html#name-404-not-found">404 Not Found</a> – there’s no resource</li><li><a href="https://www.rfc-editor.org/rfc/rfc9110.html#name-401-unauthorized">401 Unauthorized</a> – authentication failed</li><li><a href="https://www.rfc-editor.org/rfc/rfc9110.html#name-403-forbidden">403 Forbidden</a> – if any error raise</li></ul> |

Conversely, picking only three fields deemed interesting.

**Request:**

```
GET /restapi/1.0/object/res.partner?domain=[('is_company','=',True),('customer','=',True)]&fields=['name','country_id']&limit=5 HTTP/1.1
Host: {your_Odoo_server_url}
```

**JSON Response:**

```
HTTP/1.1 200 OK

{
  'Partner': [
      {
          'id': 7,
          'name': 'Agrolait',
          'country_id': [274, 'Belgium']
      },
      {
          'id': 12,
          'name': 'Think Big Systems',
          'country_id': [486, 'United Kingdom']
      },
      {
          'id': 17,
          'name': 'Edward Foster',
          'country_id': [274, 'Belgium']
      },
      {
          'id': 8,
          'name': 'China Export',
          'country_id': [302, 'China']
      },
      {
          'id': 10,
          'name': 'The Jackson Group',
          'country_id': [488, 'United States']
      }
  ]
}
```

**Note**

<mark style="background-color:blue;">even if the</mark> <mark style="background-color:blue;"></mark><mark style="background-color:blue;">`id`</mark> <mark style="background-color:blue;"></mark><mark style="background-color:blue;">the field is not requested, it is always returned</mark>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://synconics.gitbook.io/rest-api/calling-methods/read-records/read-filter-records.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
