1.3 KiB
1.3 KiB
HTTP/REST API
JSON-based REST API for web applications.
Base URL
http://localhost:9470/api
Endpoints
GET /api/users
List all users:
curl http://localhost:9470/api/users
Response:
[
{"id": 1, "name": "Alice", "age": 30},
{"id": 2, "name": "Bob", "age": 25}
]
GET /api/users/:id
Get user by ID:
curl http://localhost:9470/api/users/1
POST /api/users
Create user:
curl -X POST http://localhost:9470/api/users \
-H "Content-Type: application/json" \
-d '{"name": "Charlie", "age": 35}'
PUT /api/users/:id
Update user:
curl -X PUT http://localhost:9470/api/users/1 \
-H "Content-Type: application/json" \
-d '{"name": "Alice", "age": 31}'
DELETE /api/users/:id
Delete user:
curl -X DELETE http://localhost:9470/api/users/1
Query Endpoint
Execute BaraQL queries via HTTP:
curl -X POST http://localhost:9470/api/query \
-H "Content-Type: application/json" \
-d '{"sql": "SELECT * FROM users WHERE age > 18"}'
Error Response
{
"error": {
"code": "INVALID_QUERY",
"message": "Syntax error at line 1"
}
}
Authentication
curl -H "Authorization: Bearer <token>" \
http://localhost:9470/api/users