← 返回 Skills 市场
fisa712

Knowledge Graph - Rest Api Wrapper Generator

作者 Muhammad Asif · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
37
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install rest-api-wrapper-generator
功能描述
Generate production-ready REST API endpoints to expose graph database operations, queries, and data management capabilities
使用说明 (SKILL.md)

REST API Wrapper Generator

Purpose

This skill generates production-ready REST API endpoints that expose graph database operations and queries through a standardized HTTP interface.

It enables developers to:

  • Expose graph database queries through REST endpoints
  • Create APIs for node and relationship management
  • Retrieve and traverse graph data via HTTP requests
  • Integrate graph databases with web services and microservices
  • Provide standardized interfaces for external applications

This provides a standard HTTP interface for graph-based systems, enabling seamless integration with modern web and mobile applications.

Supported Databases

  • Neo4j
  • JanusGraph
  • RDF Triple Stores (SPARQL endpoints)
  • TigerGraph
  • Any graph database with drivers

Key Capabilities

  • Auto-generate CRUD endpoints for graph nodes
  • Auto-generate relationship management endpoints
  • Create custom query execution endpoints
  • Graph traversal and path-finding endpoints
  • Batch operation endpoints
  • Transaction support
  • Built-in authentication and authorization
  • Request validation and error handling
  • API documentation generation
  • Performance optimization features

When To Use This Skill

Use this skill when:

  • Building Backend Services: Creating REST APIs for graph-based applications
  • Exposing Graph Data: Providing HTTP access to graph databases
  • Microservices Integration: Connecting graph databases to microservices
  • Multi-Client Support: Supporting web, mobile, and desktop applications
  • External Integration: Enabling third-party systems to access graph data
  • API Development: Rapidly generating API endpoints with validation

Example Triggers

  • "Generate REST endpoints for graph operations"
  • "Create API for node and relationship management"
  • "Build REST wrapper for Neo4j database"
  • "Expose graph queries via HTTP endpoints"
  • "Generate API with authentication and rate limiting"

REST API Fundamentals

HTTP Methods

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

Status Codes

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

REST Conventions

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

API Configuration

Connection Configuration

{
  "database_type": "neo4j",
  "database_url": "bolt://localhost:7687",
  "database_user": "neo4j",
  "database_password": "password",
  "connection_pool_size": 10
}

API Configuration

{
  "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
}

Core API Patterns

Pattern 1: Node Endpoints

Retrieve All Nodes

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
}

Retrieve Specific Node

GET /api/v1/nodes/n1

Response:

{
  "id": "n1",
  "label": "Person",
  "properties": {"name": "Alice", "age": 30},
  "created_at": "2024-01-15T10:30:00Z"
}

Create Node

POST /api/v1/nodes
Content-Type: application/json

{
  "label": "Person",
  "properties": {
    "name": "Charlie",
    "age": 25,
    "email": "[email protected]"
  }
}

Response:

{
  "id": "n3",
  "label": "Person",
  "properties": {"name": "Charlie", "age": 25, "email": "[email protected]"},
  "status": "created"
}

Update Node

PUT /api/v1/nodes/n1
Content-Type: application/json

{
  "properties": {
    "age": 31
  }
}

Delete Node

DELETE /api/v1/nodes/n1

Response:

{
  "status": "deleted",
  "id": "n1"
}

Pattern 2: Relationship Endpoints

Create Relationship

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 Node Relationships

GET /api/v1/nodes/n1/relationships

Response:

{
  "relationships": [
    {
      "id": "r1",
      "from_node_id": "n1",
      "to_node_id": "n2",
      "relationship_type": "KNOWS"
    }
  ]
}

Get Node Neighbors

GET /api/v1/nodes/n1/neighbors

Response:

{
  "neighbors": [
    {"id": "n2", "label": "Person", "properties": {"name": "Bob"}}
  ]
}

Pattern 3: Query Endpoints

Execute Custom Query

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
}

Graph Traversal

POST /api/v1/traverse
Content-Type: application/json

{
  "start_node_id": "n1",
  "max_depth": 3,
  "relationship_types": ["KNOWS", "FRIEND_OF"]
}

Path Finding

POST /api/v1/paths
Content-Type: application/json

{
  "from_node_id": "n1",
  "to_node_id": "n10",
  "max_hops": 5
}

Request/Response Patterns

Pagination

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
}

Filtering

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

Sorting

GET /api/v1/nodes?sort=name
GET /api/v1/nodes?sort=-age
GET /api/v1/nodes?sort=name,age

Field Selection

GET /api/v1/nodes/n1?fields=name,age,email

Error Responses

{
  "status": "error",
  "code": "INVALID_INPUT",
  "message": "Invalid node properties",
  "details": {
    "name": "Name is required",
    "age": "Age must be positive"
  }
}

Authentication & Authorization

JWT Authentication

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...

API Key Authentication

GET /api/v1/nodes
X-API-Key: your-api-key-here

Role-Based Access Control

@api.get("/nodes/sensitive")
@require_auth(roles=["admin", "data_reader"])
def get_sensitive_nodes():
    pass

Advanced Features

Batch Operations

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": {...}}
  ]
}

Transactions

POST /api/v1/transactions
Content-Type: application/json

{
  "operations": [...]
}

Webhooks

POST /api/v1/webhooks
Content-Type: application/json

{
  "event": "node.created",
  "callback_url": "https://example.com/webhook",
  "active": true
}

Caching

GET /api/v1/nodes
Cache-Control: max-age=3600

Best Practices

1. API Design

✅ Use descriptive resource names
✅ Follow RESTful conventions
✅ Version your APIs
✅ Use proper HTTP methods and status codes
✅ Include pagination for large result sets

2. Validation

✅ Validate all input data
✅ Provide detailed error messages
✅ Use schema validation
✅ Implement type checking
✅ Check authorization permissions

3. Performance

✅ Implement pagination
✅ Use caching appropriately
✅ Create database indexes
✅ Optimize queries
✅ Use connection pooling

4. Security

✅ Require authentication for sensitive endpoints
✅ Implement rate limiting
✅ Use HTTPS in production
✅ Validate and sanitize input
✅ Implement CORS properly

5. Monitoring

✅ Log all API requests
✅ Track error rates
✅ Monitor response times
✅ Alert on anomalies
✅ Document API usage

6. Documentation

✅ Generate API documentation
✅ Include example requests/responses
✅ Document error codes
✅ Provide SDK/client libraries
✅ Keep documentation up-to-date

7. Versioning

✅ Version your API endpoints
✅ Maintain backward compatibility
✅ Deprecate endpoints gradually
✅ Provide migration guides
✅ Support multiple API versions

8. Error Handling

✅ Use standard error formats
✅ Include error codes
✅ Provide context in errors
✅ Log errors server-side
✅ Don't expose sensitive info


Integration with Related Skills

Neo4j Integration

  • Expose Neo4j queries via REST
  • Create node management APIs
  • Implement relationship endpoints

JanusGraph Connector

  • Build REST wrapper for Gremlin queries
  • Expose distributed graph operations
  • Multi-graph management APIs

RDF Triple Store Integration

  • Create SPARQL query endpoints
  • Expose RDF operations via REST
  • Named graph management

Graph Query Optimization

  • Optimize API query performance
  • Implement query result caching
  • Monitor slow endpoints

GraphQL Graph Mapping

  • Provide REST alternative to GraphQL
  • Support both REST and GraphQL APIs
  • Convert between formats

Libraries & Frameworks

Python

Library Purpose
FastAPI Modern REST framework
Flask Lightweight framework
Django REST Full-featured framework
Pydantic Data validation
SQLAlchemy Database ORM

JavaScript/Node.js

Library Purpose
Express Minimal framework
Fastify High-performance framework
Nest.js Full-featured framework
Joi Schema validation

Installation

# Python
pip install fastapi uvicorn pydantic

# Node.js
npm install express express-async-errors joi

Expected Benefits

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


Quick Reference

Generate Endpoints

generator = APIGenerator(config)
generator.create_node_endpoint("/nodes")
generator.create_relationship_endpoint("/relationships")
generator.create_query_endpoint("/query")

Add Authentication

generator.enable_authentication(
    auth_type="jwt",
    secret_key="your-secret"
)

Enable Caching

generator.enable_caching(
    ttl=3600,
    cache_backend="redis"
)

Start Server

generator.start_server(
    host="0.0.0.0",
    port=8000,
    debug=False
)

Related Skills

  • Neo4j Integration - Graph query execution
  • JanusGraph Connector - Distributed graph database
  • RDF Triple Store Integration - SPARQL querying
  • Graph Query Optimization - Query performance tuning
  • GraphQL Graph Mapping - GraphQL alternative
  • Authentication Systems - API security
  • API Gateways - Request routing and management

Resources


Version: 1.0.0
Last Updated: April 12, 2026

安全使用建议
Review carefully before installing or using this as a production template. Treat the generated APIs as scaffolding only: require authentication and authorization, avoid arbitrary query endpoints, parameterize database queries, bind local development servers to localhost, restrict webhooks, and add deletion safeguards before deployment.
能力标签
requires-oauth-tokenrequires-sensitive-credentials
能力评估
Purpose & Capability
The purpose is clear and disclosed: generate REST wrappers for graph databases. However, the advertised capabilities include data creation, updates, deletion, custom query execution, and webhooks, which are high-impact for sensitive graph data and need stronger guardrails.
Instruction Scope
The artifacts repeatedly describe the output as production-ready while showing unsafe-by-example patterns, including user-influenced query string construction, a generic query endpoint, delete endpoints, and public bind examples without prominent warnings.
Install Mechanism
No install hook, background worker, obfuscated payload, or package dependency abuse was found. The included Python script is a reference generator and mostly logs endpoint definitions rather than starting a real server.
Credentials
The requested use of database credentials and API credentials is aligned with the purpose, but examples show binding to 0.0.0.0, arbitrary query exposure, and outbound webhook URLs without adequate scoping or trust-boundary guidance.
Persistence & Privilege
The skill itself does not add persistence, privilege escalation, or hidden local access, but it guides users toward deploying persistent APIs that can mutate or delete production graph data.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install rest-api-wrapper-generator
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /rest-api-wrapper-generator 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
rest-api-wrapper-generator v1.0.0 - Initial release of a skill to generate production-ready REST API endpoints for graph databases. - Supports auto-generation of CRUD, relationship, and custom query endpoints. - Integration-ready with Neo4j, JanusGraph, RDF Triple Stores, TigerGraph, and others. - Includes built-in authentication, authorization, request validation, and error handling. - Provides standardized HTTP interface with API documentation and performance options.
元数据
Slug rest-api-wrapper-generator
版本 1.0.0
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 1
常见问题

Knowledge Graph - Rest Api Wrapper Generator 是什么?

Generate production-ready REST API endpoints to expose graph database operations, queries, and data management capabilities. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 37 次。

如何安装 Knowledge Graph - Rest Api Wrapper Generator?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install rest-api-wrapper-generator」即可一键安装,无需额外配置。

Knowledge Graph - Rest Api Wrapper Generator 是免费的吗?

是的,Knowledge Graph - Rest Api Wrapper Generator 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Knowledge Graph - Rest Api Wrapper Generator 支持哪些平台?

Knowledge Graph - Rest Api Wrapper Generator 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Knowledge Graph - Rest Api Wrapper Generator?

由 Muhammad Asif(@fisa712)开发并维护,当前版本 v1.0.0。

💬 留言讨论