» Custom Database POST API Documentation

Search Records in External Database: /external-database/{database_name}/search

POST
https://dev-api.exsited.com/api/v3external-database/{database_name}/search
Try It Out

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

ParameterTypeDescription
database_nameStringName of the external database to search within

Request Body Parameters

FieldTypeDescription
table_nameStringName of the table to search in
limitIntegerMaximum number of records to return in one response
offsetIntegerNumber of records to skip before starting to collect results (for pagination)
selected_fieldsArrayOptional. List of column names to return. If omitted, all columns are returned
conditionsArrayList of filter conditions. Each condition defines a field, operator, value, and logical operator

Condition Object Fields

FieldTypeDescription
fieldStringColumn name to filter on
operatorStringComparison operator (e.g., =, >, <, LIKE)
valueAnyValue to match
logical_operatorStringLogical 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
    }
]