API Reference
Complete reference for query2jz's API, configuration, and CLI commands.
REST API Endpoints
query2jz automatically generates REST endpoints for all your models.
Query Data
GET
Retrieve data from your models with filtering, sorting, and pagination.
Endpoint
GET /api/query2jz/:modelQuery Parameters
whereFilter conditions (JSON)orderBySort field and directionlimitNumber of records to returnoffsetNumber of records to skipincludeRelated models to includeExample
GET /api/query2jz/User?where={"status":"active"}&orderBy=createdAt:desc&limit=10&include=posts
// Response
{
"data": [
{
"id": "1",
"name": "John Doe",
"email": "john@example.com",
"status": "active",
"posts": [
{ "id": "1", "title": "Hello World" }
]
}
],
"meta": {
"total": 1,
"limit": 10,
"offset": 0
}
}Create Data
POST
Create new records in your models.
Endpoint
POST /api/query2jz/:modelRequest Body
{
"name": "John Doe",
"email": "john@example.com",
"status": "active"
}Response
{
"data": {
"id": "1",
"name": "John Doe",
"email": "john@example.com",
"status": "active",
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-01T00:00:00Z"
}
}Update Data
PUT
Update existing records in your models.
Endpoint
PUT /api/query2jz/:model/:idRequest Body
{
"name": "Jane Doe",
"status": "inactive"
}Delete Data
DELETE
Delete records from your models.
Endpoint
DELETE /api/query2jz/:model/:idResponse
{
"success": true,
"message": "Record deleted successfully"
}