query_table
Queries records from a Caspio table. The backend supports Microsoft SQL Server WHERE syntax (LIKE, AND, OR, NOT, IN, BETWEEN, comparison operators, etc.). Returns a JSON object with a 'records' array of flat key-value objects where keys are field names, and optional 'pagination' metadata when getPaginationInfo is true. Maximum 1000 records per request (default 100). For larger result sets, use pageNumber and pageSize to paginate. IMPORTANT: field names are case-insensitive and must come from discover_tables' field list -- never guess a field name from its label or from naming conventions. Call discover_tables first for any table not already discovered earlier in this conversation to get its tableId.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of records returned (skipped when pageNumber or pageSize is not empty, max = 1000, default = 100) | |
| where | No | WHERE clause. Examples: 'YesNoBoolField=1'; 'NumField=123 AND (StrField=N'Abc' OR DateField<='2001-01-31 23:59:59')'; 'Name = N'O''Brien'' (N prefix denotes Unicode, use '' to escape single quotes)' | |
| select | Yes | SELECT field list (required). Use '*' to return all fields (safe default). Examples: '*'; 'PK_ID'; 'Field1, Field2'; 'COUNT(*) as Total' | |
| groupBy | No | GROUP BY clause. Use when grouping results by specific fields with aggregate functions. Examples: 'PK_ID', 'Field1, Field2' | |
| orderBy | No | ORDER BY clause. Examples: 'PK_ID', 'Field1 ASC, Field2 DESC' | |
| tableId | Yes | Table Id (obtained from discover_tables, e.g. 'd99357') -- the table's name has no meaning for API calls; only the Id can be used here. | |
| pageSize | No | Number of records per page (possible values from 5 to 1000, default = 25) | |
| pageNumber | No | Page number (default = 1) | |
| getPaginationInfo | No | Return pagination info (total_count, page_size, page_number) in a 'pagination' object. Default is false. |