Endpoints overview
Control-table HTTP API routes
All HTTP endpoints are registered automatically by the package. You do not add these to your app's routes/api.php.
Base URL pattern
/{guard-prefix}/api-table/control-tables/{endpoint}/{tableName}/...Example (typical Laravel API setup):
| Config | Resulting base |
|---|---|
guards => ['api'] | /api/api-table/control-tables/... |
guards => ['api', 'web'] | API routes + /api-table/control-tables/... for web |
Use php artisan route:list --name=ApiTables to see exact paths in your app.
Route reference
| Method | Path suffix | Purpose |
|---|---|---|
| GET | load-table/{tableName}/{withData?} | Structure (+ optional data) |
| POST | query-table/{tableName} | Paginated rows |
| POST | bulk-table-action/{tableName}/{action} | Bulk action |
| POST | row-table-action/{tableName}/{action}/{id} | Single row action |
| POST | row-bulk-table-action/{tableName}/{action} | Row action × N ids |
| POST | row-refetch/{tableName}/{rowId} | Refresh one row |
| POST | multi-row-refetch/{tableName} | Refresh many rows |
Route names: ApiTables.{guard}.loadTable, ApiTables.{guard}.queryTableData, etc.
Authentication
Every request passes through TablesMiddleware:
default_middlewaresfrom config (usuallyauth:sanctum)- Per-table
middlewaresif defined
# All requests need a valid token by default
curl -H "Authorization: Bearer {token}" ...Response envelope
Success:
{ "success": true, ...payload }Failure (actions):
{
"success": false,
"errors": ["Action is not defined", "إجراء غير معرف"]
}HTTP 422 for action errors. Auth failures use standard Laravel 401/403.
How frontend discovers URLs
Action URLs are embedded in structure JSON — the frontend does not construct them manually:
{
"action_key": "archive",
"action": {
"api": "https://app.test/api/api-table/control-tables/row-table-action/users/archive"
},
"method": "post"
}When you rename an action key, the frontend picks up the new URL on next structure load.
Testing tips
| Tool | Use for |
|---|---|
| curl / HTTPie | Quick structure and query checks |
| Postman / Insomnia | Save token, share collection with team |
php artisan route:list | Verify guard prefix |
| Browser network tab | Compare with frontend team's requests |