Install
openclaw skills install rest-api-wrapper-generatorGenerate production-ready REST API endpoints to expose graph database operations, queries, and data management capabilities
openclaw skills install rest-api-wrapper-generatorThis skill generates production-ready REST API endpoints that expose graph database operations and queries through a standardized HTTP interface.
It enables developers to:
This provides a standard HTTP interface for graph-based systems, enabling seamless integration with modern web and mobile applications.
Use this skill when:
| Method | Operation | Idempotent | Cacheable |
|---|---|---|---|
| GET | Retrieve resources | ✓ | ✓ |
| POST | Create resources | ✗ | ✗ |
| PUT | Update resources | ✓ | ✗ |
| PATCH | Partial update | ✗ | ✗ |
| DELETE | Remove resources | ✓ | ✗ |
| HEAD | Like GET but no body | ✓ | ✓ |
| Code | Meaning | Use Case |
|---|---|---|
| 200 | OK | Successful GET, PUT, PATCH |
| 201 | Created | Successful POST |
| 204 | No Content | Successful DELETE |
| 400 | Bad Request | Invalid input |
| 401 | Unauthorized | Authentication required |
| 403 | Forbidden | Insufficient permissions |
| 404 | Not Found | Resource doesn't exist |
| 409 | Conflict | Resource conflict |
| 500 | Server Error | Internal error |
| 503 | Service Unavailable | Server maintenance |
GET /api/v1/nodes - List all nodes
GET /api/v1/nodes/{id} - Get specific node
POST /api/v1/nodes - Create new node
PUT /api/v1/nodes/{id} - Update node
DELETE /api/v1/nodes/{id} - Delete node
GET /api/v1/relationships - List relationships
POST /api/v1/relationships - Create relationship
DELETE /api/v1/relationships/{id} - Delete relationship
POST /api/v1/query - Execute query
GET /api/v1/nodes/{id}/neighbors - Get connected nodes
{
"database_type": "neo4j",
"database_url": "bolt://localhost:7687",
"database_user": "neo4j",
"database_password": "password",
"connection_pool_size": 10
}
{
"api_title": "Knowledge Graph API",
"api_version": "1.0.0",
"base_path": "/api/v1",
"host": "0.0.0.0",
"port": 8000,
"enable_cors": true,
"enable_authentication": true,
"authentication_type": "jwt",
"enable_rate_limiting": true,
"rate_limit_requests": 1000,
"rate_limit_window": 3600
}
GET /api/v1/nodes?limit=20&offset=0
Response:
{
"nodes": [
{"id": "n1", "label": "Person", "properties": {"name": "Alice"}},
{"id": "n2", "label": "Person", "properties": {"name": "Bob"}}
],
"total": 100,
"limit": 20,
"offset": 0
}
GET /api/v1/nodes/n1
Response:
{
"id": "n1",
"label": "Person",
"properties": {"name": "Alice", "age": 30},
"created_at": "2024-01-15T10:30:00Z"
}
POST /api/v1/nodes
Content-Type: application/json
{
"label": "Person",
"properties": {
"name": "Charlie",
"age": 25,
"email": "charlie@example.com"
}
}
Response:
{
"id": "n3",
"label": "Person",
"properties": {"name": "Charlie", "age": 25, "email": "charlie@example.com"},
"status": "created"
}
PUT /api/v1/nodes/n1
Content-Type: application/json
{
"properties": {
"age": 31
}
}
DELETE /api/v1/nodes/n1
Response:
{
"status": "deleted",
"id": "n1"
}
POST /api/v1/relationships
Content-Type: application/json
{
"from_node_id": "n1",
"to_node_id": "n2",
"relationship_type": "KNOWS",
"properties": {
"since": "2020-01-15"
}
}
Response:
{
"id": "r1",
"from_node_id": "n1",
"to_node_id": "n2",
"relationship_type": "KNOWS",
"properties": {"since": "2020-01-15"},
"status": "created"
}
GET /api/v1/nodes/n1/relationships
Response:
{
"relationships": [
{
"id": "r1",
"from_node_id": "n1",
"to_node_id": "n2",
"relationship_type": "KNOWS"
}
]
}
GET /api/v1/nodes/n1/neighbors
Response:
{
"neighbors": [
{"id": "n2", "label": "Person", "properties": {"name": "Bob"}}
]
}
POST /api/v1/query
Content-Type: application/json
{
"query": "MATCH (n:Person) WHERE n.age > 25 RETURN n",
"limit": 100
}
Response:
{
"results": [
{"n": {"id": "n1", "label": "Person", "properties": {"name": "Alice", "age": 30}}}
],
"execution_time_ms": 42
}
POST /api/v1/traverse
Content-Type: application/json
{
"start_node_id": "n1",
"max_depth": 3,
"relationship_types": ["KNOWS", "FRIEND_OF"]
}
POST /api/v1/paths
Content-Type: application/json
{
"from_node_id": "n1",
"to_node_id": "n10",
"max_hops": 5
}
GET /api/v1/nodes?limit=20&offset=40
Query Parameters:
limit - Number of results (default: 20, max: 100)offset - Starting position (default: 0)Response includes:
{
"data": [...],
"total": 500,
"limit": 20,
"offset": 40
}
GET /api/v1/nodes?filter[name]=Alice&filter[age]=30
GET /api/v1/nodes?filter[age][gt]=25
GET /api/v1/nodes?filter[status][in]=active,pending
GET /api/v1/nodes?sort=name
GET /api/v1/nodes?sort=-age
GET /api/v1/nodes?sort=name,age
GET /api/v1/nodes/n1?fields=name,age,email
{
"status": "error",
"code": "INVALID_INPUT",
"message": "Invalid node properties",
"details": {
"name": "Name is required",
"age": "Age must be positive"
}
}
POST /api/v1/auth/login
Content-Type: application/json
{
"username": "user",
"password": "password"
}
Response:
{
"token": "eyJhbGc...",
"expires_in": 3600
}
Using token:
GET /api/v1/nodes
Authorization: Bearer eyJhbGc...
GET /api/v1/nodes
X-API-Key: your-api-key-here
@api.get("/nodes/sensitive")
@require_auth(roles=["admin", "data_reader"])
def get_sensitive_nodes():
pass
POST /api/v1/batch
Content-Type: application/json
{
"operations": [
{"method": "POST", "path": "/nodes", "body": {...}},
{"method": "POST", "path": "/relationships", "body": {...}},
{"method": "PUT", "path": "/nodes/n1", "body": {...}}
]
}
Response:
{
"results": [
{"status": 201, "body": {...}},
{"status": 201, "body": {...}},
{"status": 200, "body": {...}}
]
}
POST /api/v1/transactions
Content-Type: application/json
{
"operations": [...]
}
POST /api/v1/webhooks
Content-Type: application/json
{
"event": "node.created",
"callback_url": "https://example.com/webhook",
"active": true
}
GET /api/v1/nodes
Cache-Control: max-age=3600
✅ Use descriptive resource names
✅ Follow RESTful conventions
✅ Version your APIs
✅ Use proper HTTP methods and status codes
✅ Include pagination for large result sets
✅ Validate all input data
✅ Provide detailed error messages
✅ Use schema validation
✅ Implement type checking
✅ Check authorization permissions
✅ Implement pagination
✅ Use caching appropriately
✅ Create database indexes
✅ Optimize queries
✅ Use connection pooling
✅ Require authentication for sensitive endpoints
✅ Implement rate limiting
✅ Use HTTPS in production
✅ Validate and sanitize input
✅ Implement CORS properly
✅ Log all API requests
✅ Track error rates
✅ Monitor response times
✅ Alert on anomalies
✅ Document API usage
✅ Generate API documentation
✅ Include example requests/responses
✅ Document error codes
✅ Provide SDK/client libraries
✅ Keep documentation up-to-date
✅ Version your API endpoints
✅ Maintain backward compatibility
✅ Deprecate endpoints gradually
✅ Provide migration guides
✅ Support multiple API versions
✅ Use standard error formats
✅ Include error codes
✅ Provide context in errors
✅ Log errors server-side
✅ Don't expose sensitive info
| Library | Purpose |
|---|---|
| FastAPI | Modern REST framework |
| Flask | Lightweight framework |
| Django REST | Full-featured framework |
| Pydantic | Data validation |
| SQLAlchemy | Database ORM |
| Library | Purpose |
|---|---|
| Express | Minimal framework |
| Fastify | High-performance framework |
| Nest.js | Full-featured framework |
| Joi | Schema validation |
# Python
pip install fastapi uvicorn pydantic
# Node.js
npm install express express-async-errors joi
Using this skill enables:
✅ Rapid API Development - Auto-generate endpoints instead of manual coding
✅ Standardized Interface - Consistent REST API across projects
✅ Easy Integration - Connect graph databases to web/mobile apps
✅ Microservices Ready - Built-in support for distributed architectures
✅ Built-in Security - Authentication, authorization, rate limiting
✅ Developer Friendly - Auto-generated documentation and SDKs
✅ Production Ready - Error handling, logging, monitoring
✅ Performance Optimized - Pagination, caching, query optimization
generator = APIGenerator(config)
generator.create_node_endpoint("/nodes")
generator.create_relationship_endpoint("/relationships")
generator.create_query_endpoint("/query")
generator.enable_authentication(
auth_type="jwt",
secret_key="your-secret"
)
generator.enable_caching(
ttl=3600,
cache_backend="redis"
)
generator.start_server(
host="0.0.0.0",
port=8000,
debug=False
)
Version: 1.0.0
Last Updated: April 12, 2026