Rest API
  • Odoo REST API: Version 1.0 documentation
  • Connection
    • Configuration
    • Demo
    • Logging In
      • How you can do
        • Odoo Version Information
        • Oauth1 Authentication
        • OAuth2 Authentication
        • Basic Authentication
  • Calling Methods
    • Check Access Rights
    • List Records
      • Pagination
    • Count Records
    • Read Records
      • Read Single Record
      • Read List Records
      • Read Filter Records
    • Listing Record Fields
    • Create Records
    • Update Records
      • Update Single Record
      • Update List Records
    • Delete Records
      • Delete Single Record
      • Delete List Records
  • Report Printing
    • Print Single Report
    • Print List Reports
  • Inspection and Introspection
    • ir.model
    • ir.model.fields
Powered by GitBook
On this page
  1. Calling Methods

Count Records

PreviousPaginationNextRead Records

Last updated 1 year ago

Rather than retrieve a possibly gigantic list of records and count them, can be used to retrieve only the number of records matching the query. It takes the same filter as and no other parameter.

Warning

calling restapi/1.0/object/{object_name}/search then restapi/1.0/object/{object_name}/search_count (or the other way around) may not yield coherent results if other users are using the server: stored data could have changed between the calls

GET /restapi/1.0/object/{object_name}/search_count

Request:

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

JSON Response:

HTTP/1.1 200 OK

{
  'count': 19
}

XML Response:

HTTP/1.1 200 OK

<count>19</count>

Query Parameters:

Headers and Status Codes
Description

Request Headers

Response Headers

Status Codes

domain – A . Use an empty list to match all records.

– the response content type depends on Accept header

– The OAuth protocol parameters to authenticate.

– this depends on Accept header of the request

– no error

– there’s no resource

– authentication failed

– if any error raise

search_count()
domain
search()
search domain
Accept
Authorization
Content-Type
200 OK
404 Not Found
401 Unauthorized
403 Forbidden