ACE API Endpoints

ACE includes API endpoints for some of its most frequently used functions.

API Reference

ACE provides a REST API for programmatic access. The API server runs on localhost:5000 by default. An SSH tunnel is required to access the API from outside the host machine for security purposes.

The table-diff API

Initiates a table diff operation.

Endpoint: GET /ace/table-diff

Parameters:

  • cluster_name (required): Name of the cluster
  • table_name (required): Fully qualified table name (schema.table)
  • dbname (optional): Database name
  • block_rows (optional): Number of rows per block (default: 10000)
  • max_cpu_ratio (optional): Maximum CPU usage ratio (default: 0.8)
  • output (optional): Output format ["json", "csv", "html"] (default: "json")
  • nodes (optional): Nodes to include ("all" or comma-separated list)
  • batch_size (optional): Batch size for processing (default: 50)
  • table_filter (optional): SQL WHERE clause to filter rows for comparison
  • quiet (optional): Suppress output (default: false)

Example Request:

curl "http://localhost:5000/ace/table-diff?cluster_name=my_cluster&table_name=public.users&output=html"

Example Response:

{
    "task_id": "td_20240315_123456",
    "submitted_at": "2024-03-15T12:34:56.789Z"
}

The table-repair API

Initiates a table repair operation.

Endpoint: GET /ace/table-repair

Parameters:

  • cluster_name (required): Name of the cluster
  • diff_file (required): Path to the diff file
  • source_of_truth (required): Source node for repairs
  • table_name (required): Fully qualified table name
  • dbname (optional): Database name
  • dry_run (optional): Simulate repairs (default: false)
  • quiet (optional): Suppress output (default: false)
  • generate_report (optional): Create detailed report (default: false)
  • upsert_only (optional): Skip deletions (default: false)

Example Request:

curl "http://localhost:5000/ace/table-repair?cluster_name=my_cluster&diff_file=/path/to/diff.json&source_of_truth=primary&table_name=public.users"

Example Response:

{
    "task_id": "tr_20240315_123456",
    "submitted_at": "2024-03-15T12:34:56.789Z"
}

The table-rerun API

Reruns a previous table diff operation.

Endpoint: GET /ace/table-rerun

Parameters:

  • cluster_name (required): Name of the cluster
  • diff_file (required): Path to the previous diff file
  • table_name (required): Fully qualified table name
  • dbname (optional): Database name
  • quiet (optional): Suppress output (default: false)
  • behavior (optional): Processing behavior ["multiprocessing", "hostdb"]

Example Request:

curl "http://localhost:5000/ace/table-rerun?cluster_name=my_cluster&diff_file=/path/to/diff.json&table_name=public.users"

Example Response:

{
    "task_id": "tr_20240315_123456",
    "submitted_at": "2024-03-15T12:34:56.789Z"
}

The task-status API

Retrieves the status of a submitted task.

Endpoint: GET /ace/task-status/<task_id>

Example Request:

curl "http://localhost:5000/ace/task-status/td_20240315_123456"

Example Response:

{
    "task_id": "td_20240315_123456",
    "task_type": "table-diff",
    "status": "COMPLETED",
    "started_at": "2024-03-15T12:34:56.789Z",
    "finished_at": "2024-03-15T12:35:01.234Z",
    "time_taken": 4.445,
    "result": {
        "diff_file": "/path/to/output.json",
        "total_rows": 10000,
        "mismatched_rows": 5
        "summary": {
 
        }
    }
}

API Error Responses

ACE API endpoints return error responses in the following format:

{
    "error": "Description of what went wrong"
}

Common HTTP status codes:

  • 200: Success
  • 400: Bad Request (missing or invalid parameters)
  • 404: Not Found (invalid cluster or task ID)
  • 500: Internal Server Error