Search By Conditions
POST {{HDB_ENDPOINT}}
Returns data from a table for one or more matching conditions.
operation (required) - must always be 'search_by_conditions'
schema (required) - schema where the table you are searching lives
table (required) - table you wish to search
operator (optional) - the operator used between each condition - 'and', 'or'. The default is 'and'.
offset (optional) - the number of records that the query results will skip. The default is 0.
limit (optional) - the number of records that the query results will include. The default is null, resulting in no limit.
get_attributes (required) - define which attributes you want returned. Use ['*'] to return all attributes.
conditions (required) - the array of conditions objects, specified below, to filter by. Must include one or more object in the array.
search_attribute (required) - the attribute you wish to search, can be any attribute.
search_type (required) - the type of search to perform - 'equals', 'contains', 'starts_with', 'ends_with', 'greater_than', 'greater_than_equal', 'less_than', 'less_than_equal', 'between'.
search_value (required) - case-sensitive value you wish to search. If the search_type is 'between' then use an array of two values to search between.
Request Body
{"operation"=>"search_by_conditions", "schema"=>"dev", "table"=>"dog", "operator"=>"and", "offset"=>0, "limit"=>10, "get_attributes"=>["*"], "conditions"=>[{"search_attribute"=>"age", "search_type"=>"between", "search_value"=>[5, 8]}, {"search_attribute"=>"weight_lbs", "search_type"=>"greater_than", "search_value"=>40}, {"search_attribute"=>"adorable", "search_type"=>"equals", "search_value"=>true}]}
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Content-Type | string |
RESPONSES
status: OK
[{"__createdtime__":1620227719791,"__updatedtime__":1620227719791,"adorable":true,"age":7,"breed_id":346,"dog_name":"Harper","id":2,"owner_name":"Stephen","weight_lbs":55},{"__createdtime__":1620227719792,"__updatedtime__":1620227719792,"adorable":true,"age":7,"breed_id":348,"dog_name":"Alby","id":3,"owner_name":"Kaylan","weight_lbs":84},{"__createdtime__":1620227719792,"__updatedtime__":1620227719792,"adorable":true,"age":6,"breed_id":347,"dog_name":"Billy","id":4,"owner_name":"Zach","weight_lbs":60},{"__createdtime__":1620227719792,"__updatedtime__":1620227719792,"adorable":true,"age":5,"breed_id":250,"dog_name":"Gemma","id":8,"owner_name":"Stephen","weight_lbs":55},{"__createdtime__":1620227719792,"__updatedtime__":1620227719792,"adorable":true,"age":8,"breed_id":104,"dog_name":"Bode","id":11,"owner_name":"Margo","weight_lbs":75}]