Database Services

Working with Your Database

WoWSQL automatically generates REST APIs for every table in your database. Query, insert, update, and delete data with simple HTTP requests.

Querying Data

Query your tables with powerful filtering, sorting, and pagination:

POST /api/v1/db/tables/{table_name}/query

Headers:
  Authorization: Bearer YOUR_API_KEY
  X-Project-Slug: your-project-slug
  Content-Type: application/json

Body:
{
  "select": ["id", "name", "email"],
  "filters": [
    {"column": "status", "operator": "eq", "value": "active"},
    {"column": "created_at", "operator": "gte", "value": "2024-01-01"}
  ],
  "order_by": [{"column": "created_at", "direction": "desc"}],
  "limit": 20,
  "offset": 0
}

Filter Operators

Use these operators in your filters:

  • eq - Equal to
  • ne - Not equal to
  • gt - Greater than
  • gte - Greater than or equal
  • lt - Less than
  • lte - Less than or equal
  • like - Pattern matching
  • in - Value in array
  • is_null - Is NULL
  • is_not_null - Is not NULL

Inserting Data

POST /api/v1/db/tables/{table_name}/query

Headers:
  Authorization: Bearer YOUR_API_KEY
  X-Project-Slug: your-project-slug
  Content-Type: application/json

Body:
{
  "insert": {
    "name": "John Doe",
    "email": "john@example.com",
    "status": "active"
  }
}

Updating Data

PUT /api/v1/db/tables/{table_name}/query

Headers:
  Authorization: Bearer YOUR_API_KEY
  X-Project-Slug: your-project-slug
  Content-Type: application/json

Body:
{
  "filters": [
    {"column": "id", "operator": "eq", "value": 1}
  ],
  "update": {
    "name": "Jane Doe",
    "status": "inactive"
  }
}

Deleting Data

DELETE /api/v1/db/tables/{table_name}/query

Headers:
  Authorization: Bearer YOUR_API_KEY
  X-Project-Slug: your-project-slug
  Content-Type: application/json

Body:
{
  "filters": [
    {"column": "id", "operator": "eq", "value": 1}
  ]
}

Running Custom SQL

Execute custom SQL queries when needed:

POST /api/v1/db/execute

Headers:
  Authorization: Bearer YOUR_API_KEY
  X-Project-Slug: your-project-slug
  Content-Type: application/json

Body:
{
  "sql": "SELECT COUNT(*) as total FROM users WHERE status = 'active'"
}