|
| 1 | +--- |
| 2 | +title: API Reference |
| 3 | +description: DataMate API documentation |
| 4 | +weight: 4 |
| 5 | +--- |
| 6 | + |
| 7 | +{{% pageinfo %}} |
| 8 | +DataMate provides complete REST APIs supporting programmatic access to all core features. |
| 9 | +{{% /pageinfo %}} |
| 10 | + |
| 11 | +## API Overview |
| 12 | + |
| 13 | +DataMate API is based on REST architecture design, providing the following services: |
| 14 | + |
| 15 | +- **Data Management API**: Dataset and file management |
| 16 | +- **Data Cleaning API**: Data cleaning task management |
| 17 | +- **Data Collection API**: Data collection task management |
| 18 | +- **Data Annotation API**: Data annotation task management |
| 19 | +- **Data Synthesis API**: Data synthesis task management |
| 20 | +- **Data Evaluation API**: Data evaluation task management |
| 21 | +- **Operator Market API**: Operator management |
| 22 | +- **RAG Indexer API**: Knowledge base and vector retrieval |
| 23 | +- **Pipeline Orchestration API**: Pipeline orchestration management |
| 24 | + |
| 25 | +## Authentication |
| 26 | + |
| 27 | +DataMate supports two authentication methods: |
| 28 | + |
| 29 | +### JWT Authentication (Recommended) |
| 30 | + |
| 31 | +```http |
| 32 | +GET /api/v1/data-management/datasets |
| 33 | +Authorization: Bearer <your-jwt-token> |
| 34 | +``` |
| 35 | + |
| 36 | +Get JWT Token: |
| 37 | + |
| 38 | +```http |
| 39 | +POST /api/v1/auth/login |
| 40 | +Content-Type: application/json |
| 41 | +
|
| 42 | +{ |
| 43 | + "username": "admin", |
| 44 | + "password": "password" |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +Response: |
| 49 | + |
| 50 | +```json |
| 51 | +{ |
| 52 | + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", |
| 53 | + "expiresIn": 86400 |
| 54 | +} |
| 55 | +``` |
| 56 | + |
| 57 | +### API Key Authentication |
| 58 | + |
| 59 | +```http |
| 60 | +GET /api/v1/data-management/datasets |
| 61 | +X-API-Key: <your-api-key> |
| 62 | +``` |
| 63 | + |
| 64 | +## Common Response Format |
| 65 | + |
| 66 | +### Success Response |
| 67 | + |
| 68 | +```json |
| 69 | +{ |
| 70 | + "code": 200, |
| 71 | + "message": "success", |
| 72 | + "data": { |
| 73 | + // Response data |
| 74 | + } |
| 75 | +} |
| 76 | +``` |
| 77 | + |
| 78 | +### Error Response |
| 79 | + |
| 80 | +```json |
| 81 | +{ |
| 82 | + "code": 400, |
| 83 | + "message": "Bad Request", |
| 84 | + "error": "Invalid parameter: datasetId", |
| 85 | + "timestamp": "2024-01-15T10:30:00Z", |
| 86 | + "path": "/api/v1/data-management/datasets" |
| 87 | +} |
| 88 | +``` |
| 89 | + |
| 90 | +### Paged Response |
| 91 | + |
| 92 | +```json |
| 93 | +{ |
| 94 | + "content": [], |
| 95 | + "page": 0, |
| 96 | + "size": 20, |
| 97 | + "totalElements": 100, |
| 98 | + "totalPages": 5, |
| 99 | + "first": true, |
| 100 | + "last": false |
| 101 | +} |
| 102 | +``` |
| 103 | + |
| 104 | +## API Endpoints |
| 105 | + |
| 106 | +### Data Management |
| 107 | + |
| 108 | +| Endpoint | Method | Description | |
| 109 | +|----------|--------|-------------| |
| 110 | +| `/data-management/datasets` | GET | Get dataset list | |
| 111 | +| `/data-management/datasets` | POST | Create dataset | |
| 112 | +| `/data-management/datasets/{id}` | GET | Get dataset details | |
| 113 | +| `/data-management/datasets/{id}` | PUT | Update dataset | |
| 114 | +| `/data-management/datasets/{id}` | DELETE | Delete dataset | |
| 115 | +| `/data-management/datasets/{id}/files` | GET | Get file list | |
| 116 | +| `/data-management/datasets/{id}/files/upload` | POST | Upload files | |
| 117 | + |
| 118 | +### Data Cleaning |
| 119 | + |
| 120 | +| Endpoint | Method | Description | |
| 121 | +|----------|--------|-------------| |
| 122 | +| `/data-cleaning/tasks` | GET | Get cleaning task list | |
| 123 | +| `/data-cleaning/tasks` | POST | Create cleaning task | |
| 124 | +| `/data-cleaning/tasks/{id}` | GET | Get task details | |
| 125 | +| `/data-cleaning/tasks/{id}` | PUT | Update task | |
| 126 | +| `/data-cleaning/tasks/{id}` | DELETE | Delete task | |
| 127 | +| `/data-cleaning/tasks/{id}/execute` | POST | Execute task | |
| 128 | + |
| 129 | +### Data Collection |
| 130 | + |
| 131 | +| Endpoint | Method | Description | |
| 132 | +|----------|--------|-------------| |
| 133 | +| `/data-collection/tasks` | GET | Get collection task list | |
| 134 | +| `/data-collection/tasks` | POST | Create collection task | |
| 135 | +| `/data-collection/tasks/{id}` | GET | Get task details | |
| 136 | +| `/data-collection/tasks/{id}/execute` | POST | Execute collection task | |
| 137 | + |
| 138 | +### Data Synthesis |
| 139 | + |
| 140 | +| Endpoint | Method | Description | |
| 141 | +|----------|--------|-------------| |
| 142 | +| `/data-synthesis/tasks` | GET | Get synthesis task list | |
| 143 | +| `/data-synthesis/tasks` | POST | Create synthesis task | |
| 144 | +| `/data-synthesis/templates` | GET | Get instruction template list | |
| 145 | +| `/data-synthesis/templates` | POST | Create instruction template | |
| 146 | + |
| 147 | +### Operator Market |
| 148 | + |
| 149 | +| Endpoint | Method | Description | |
| 150 | +|----------|--------|-------------| |
| 151 | +| `/operator-market/operators` | GET | Get operator list | |
| 152 | +| `/operator-market/operators` | POST | Publish operator | |
| 153 | +| `/operator-market/operators/{id}` | GET | Get operator details | |
| 154 | +| `/operator-market/operators/{id}/install` | POST | Install operator | |
| 155 | + |
| 156 | +### RAG Indexer |
| 157 | + |
| 158 | +| Endpoint | Method | Description | |
| 159 | +|----------|--------|-------------| |
| 160 | +| `/rag/knowledge-bases` | GET | Get knowledge base list | |
| 161 | +| `/rag/knowledge-bases` | POST | Create knowledge base | |
| 162 | +| `/rag/knowledge-bases/{id}/documents` | POST | Upload documents | |
| 163 | +| `/rag/knowledge-bases/{id}/search` | POST | Vector search | |
| 164 | + |
| 165 | +## Error Codes |
| 166 | + |
| 167 | +| Code | Description | |
| 168 | +|------|-------------| |
| 169 | +| 200 | Success | |
| 170 | +| 201 | Created | |
| 171 | +| 400 | Bad Request | |
| 172 | +| 401 | Unauthorized | |
| 173 | +| 403 | Forbidden | |
| 174 | +| 404 | Not Found | |
| 175 | +| 409 | Conflict | |
| 176 | +| 500 | Internal Server Error | |
| 177 | + |
| 178 | +## Rate Limiting |
| 179 | + |
| 180 | +API call rate limits: |
| 181 | + |
| 182 | +- **Default limit**: 1000 requests/hour |
| 183 | +- **Burst limit**: 100 requests/minute |
| 184 | + |
| 185 | +Exceeding the limit returns `429 Too Many Requests`. |
| 186 | + |
| 187 | +Response headers contain rate limiting information: |
| 188 | + |
| 189 | +```http |
| 190 | +X-RateLimit-Limit: 1000 |
| 191 | +X-RateLimit-Remaining: 999 |
| 192 | +X-RateLimit-Reset: 1642252800 |
| 193 | +``` |
| 194 | + |
| 195 | +## Version Management |
| 196 | + |
| 197 | +API versions are specified through URL paths: |
| 198 | + |
| 199 | +- Current version: `/api/v1/` |
| 200 | +- Future versions: `/api/v2/` |
| 201 | + |
| 202 | +## Related Documentation |
| 203 | + |
| 204 | +- [Developer Guide](/docs/developer-guide/) - Architecture and development guide |
| 205 | +- [OpenAPI Specifications](https://github.com/ModelEngine-Group/DataMate/tree/main/backend/openapi/specs) - Complete OpenAPI specs |
0 commit comments