Search Records in External Database: /external-database/{database_name}/search
Purpose
This API allows you to search for specific records within a table of an external database. You can apply conditions to filter the records, control how many results are returned at once, and optionally select only the columns you need. If no specific columns are selected, the API will return all columns for the matched records. This is useful for quickly finding specific data without manually sifting through the entire database.
Use Case
This API is useful for retrieving specific records from a table in an external database based on defined search conditions. It allows users to quickly find data such as a particular ID, name, or any other field without manually browsing the entire table. The ability to limit the number of results and skip records with pagination makes it easier to manage large datasets. Additionally, users can choose to retrieve only specific columns to reduce response size and focus on the most relevant information. This functionality is ideal for dashboards, reporting, or any application that needs filtered data from the database efficiently.
Path Parameters
Parameter | Type | Description |
---|---|---|
database_name | String | Name of the external database to search within |
Request Body Parameters
Field | Type | Description |
---|---|---|
table_name | String | Name of the table to search in |
limit | Integer | Maximum number of records to return in one response |
offset | Integer | Number of records to skip before starting to collect results (for pagination) |
selected_fields | Array | Optional. List of column names to return. If omitted, all columns are returned |
conditions | Array | List of filter conditions. Each condition defines a field, operator, value, and logical operator |
Condition Object Fields
Field | Type | Description |
---|---|---|
field | String | Column name to filter on |
operator | String | Comparison operator (e.g., =, >, <, LIKE) |
value | Any | Value to match |
logical_operator | String | Logical operator to combine conditions (AND/OR) |
Request Body
{
"table_name": "sample_table",
"limit": 10,
"offset": 0,
"selected_fields": ["field_1"],
"conditions": [
{
"field": "field_1",
"operator": "=",
"value": "sample_value",
"logical_operator": "AND"
}
]
}
Response
This API returns a list of records from the specified table that match the search conditions. The response includes pagination metadata such as count
(total matching records), limit
(maximum records returned per page), and offset
(records skipped). It also provides the list of records grouped under the table name, with each record represented as a JSON object containing column names as keys and their corresponding values. Additionally, the response contains a success flag indicating whether the request was processed successfully, along with an HTTP code representing the status of the response. If the specified database, table, or requested fields do not exist, or if the user lacks permissions, the API returns an error response with descriptive messages to assist in understanding and resolving the issue
Response Body
[
{
"count": 1,
"limit": 10,
"list": {
"sample_table": [
{
"field_1": "Sample Value 1",
"field_2": "Sample Value 2",
"field_3": "Sample Value 3"
}
]
},
"offset": 0,
"success": true,
"code": 200
}
]