-
Notifications
You must be signed in to change notification settings - Fork 0
Response Format
Shashank Patil edited this page Jul 26, 2026
·
1 revision
The Generic SQL API Framework returns responses in JSON format. Every response follows a consistent structure, making it easy to integrate with frontend applications, mobile apps, and third-party systems.
A successful request returns the requested data.
{
"success": true,
"message": "Query executed successfully.",
"data": [
{
"CustomerID": 1,
"CustomerName": "John Doe",
"City": "Bangalore"
}
]
}If no records match the query, the request is still considered successful.
{
"success": true,
"message": "No records found.",
"data": []
}If an error occurs during validation or execution, the framework returns an error response.
{
"success": false,
"message": "Query file not found."
}Example:
{
"success": false,
"message": "Missing required parameter: CustomerID"
}Example:
{
"success": false,
"message": "Database connection failed."
}Example:
{
"success": false,
"message": "SQL execution failed."
}When pagination is enabled, additional metadata may be included.
{
"success": true,
"data": [
{
"CustomerID": 1,
"CustomerName": "John Doe"
}
],
"pagination": {
"page": 1,
"pageSize": 25,
"totalRecords": 450,
"totalPages": 18
}
}Some endpoints may return additional metadata.
{
"success": true,
"metadata": {
"database": "AdventureWorks",
"server": "SQLSERVER01",
"executionTime": "15 ms",
"rowsReturned": 250
},
"data": []
}| Field | Description |
|---|---|
| success | Indicates whether the request succeeded |
| message | Human-readable status message |
| data | Query result set |
| pagination | Pagination information (optional) |
| metadata | Additional execution details (optional) |
| Status Code | Description |
|---|---|
| 200 | Request completed successfully |
| 400 | Invalid request or validation error |
| 404 | Query file not found |
| 500 | Internal server or database error |
- Always check the
successfield before processing data. - Handle empty result sets gracefully.
- Display meaningful error messages to users.
- Log server-side errors for troubleshooting.
Continue with:
- Error Handling
- Performance Tips
- Security Best Practices
- Framework Architecture