/ GET
Overview
Lists filtered records.
Summary
This endpoint will return a set of records filtered by an expression. The filter can be applied to multiple fields and have multiple and/or conditions in it. Alternatively, you may use an existing filter by specifying its id. If both a filter definition and a filter id are passed, the two filters will be joined with an AND
. Care will need to be taken to make sure that any filters used have appropriate indexes on the server side otherwise the runtime of the endpoint will be very long. Related fields can be searched by specifying the field name as: "link_name.remote_field", so if you wished to search the Accounts module by a related member account you would use "members.sic_code".
Request Arguments
Name | Type | Description | Required |
---|---|---|---|
filter | String | The filter expression. Filter expressions are explained below. Note that JSON-encoded filters can be specified as query parameters in one of two ways for GET requests:
|
False |
filter_id | String | Identifier for a preexisting filter. If filter is also set, the two filters are joined with an AND . |
False |
max_num | Integer | A maximum number of records to return. Default is 20. | False |
offset | Integer | The number of records to skip over before records are returned. Default is 0. | False |
fields | String |
Comma delimited list of fields to return. Each field may be represented either by string, or by map containing field name and additional field parameters (applicable to link and collection fields). The fields Note: Additional field parameters for link and collection fields, only available when retrieving a single record. |
False |
view | String | Instead of defining the fields argument, the view argument can be used instead. The field list is constructed at the server side based on the view definition which is requested. This argument can be used in combination with the fields argument. Common views are "record" and "list". Example: record |
False |
order_by | String | How to sort the returned records, in a comma delimited list with the direction appended to the column name after a colon. Example: name:DESC,account_type:DESC,date_modified:ASC |
False |
q | String | A search expression, will search on this module. Cannot be used at the same time as a filter expression or id. | False |
deleted | Boolean | Boolean to show deleted records in the result set. | False |
nulls_last | Boolean | Boolean to return records with null values in order_by fields last in the result set. | False |
Filter Expressions
There are four types of filters:
Basic
Example
{ "filter":[ { "name":"Nelson Inc" } ] }
Full
Example
{ "filter":[ { "name":{ "$starts":"Nelson" } } ] }Below is a list of operation types:
Operation | Description |
---|---|
$equals | Performs an exact match on that field. |
$not_equals | Performs an exact match on that field. |
$not_equals | Matches on non-matching values. |
$starts | Matches on anything that starts with the value. |
$ends | Matches anything that ends with the value. |
$contains | Matches anything that contains the value |
$in | Finds anything where field matches one of the values as specified as an array. |
$not_in | Finds anything where field does not matches any of the values as specified as an array. |
$is_null | Checks if the field is null. This operation does not need a value specified. |
$not_null | Checks if the field is not null. This operation does not need a value specified. |
$lt | Matches when the field is less than the value. |
$lte | Matches when the field is less than or equal to the value. |
$gt | Matches when the field is greater than the value. |
$gte | Matches when the field is greater than or equal to the value. |
Sub-expressions
Example
{ "filter":[ { "$or":[ { "name":"Nelson Inc" }, { "name":"Nelson LLC" } ] } ] }
Modules
Example
{ "filter":[ { "$favorite":"_this" } ] }
Response Arguments
Name | Type | Description |
---|---|---|
next_offset | Integer | Displays the next offset for retrieval of additional results. -1 will be returned when there are no more records. |
records | Array | An array of results containing matched records. |
Response
{ "next_offset":-1, "records":[ { "id":"fa300a0e-0ad1-b322-9601-512d0983c19a", "name":"Dale Spivey", "date_modified":"2013-02-28T05:03:00+00:00", "description":"", "opportunities": [ { _module: "Opportunities", "id": "b0701501-1fab-8ae7-3942-540da93f5017", "name": "360 Vacations - 228 Units", "date_modified": "2014-09-08T16:05:00+03:00", "sales_status": "New" }, ], "_acl": { "fields": { } } }, { "id":"95e17367-9b3d-0e26-22dc-512d0961fedf", "name":"Florence Haddock", "date_modified":"2013-02-26T19:12:00+00:00", "description":"", "opportunities": [ { _module: "Opportunities" date_modified: "2014-09-08T16:05:00+03:00" id: "9ce7c088-8ee4-7cd3-18f1-540da944d4c0" name: "360 Vacations - 312 Units" sales_status: "New" }, ], "_acl": { "fields": { } } } ] }
Change Log
Version | Change |
---|---|
v10 | Added /<module>/filter GET endpoint. |