1570 lines
24 KiB
Markdown
1570 lines
24 KiB
Markdown
# NoCopy REST API Documentation
|
|
|
|
## Оглавление
|
|
1. [Authentication & User Management](#authentication--user-management)
|
|
2. [Search Settings](#search-settings)
|
|
3. [Global Search](#global-search)
|
|
4. [Payments](#payments)
|
|
5. [Payouts](#payouts)
|
|
6. [Files](#files)
|
|
7. [API Keys](#api-keys)
|
|
8. [Health Check](#health-check)
|
|
9. [Migration](#migration)
|
|
|
|
---
|
|
|
|
## Authentication & User Management
|
|
|
|
### Base URL
|
|
```
|
|
v1/api/user
|
|
```
|
|
|
|
### 1. Get User Info
|
|
**Endpoint:** `GET /v1/api/user`
|
|
|
|
**Query Parameters:**
|
|
- `email` (string, required) - User email address
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"id": "string",
|
|
"email": "user@example.com",
|
|
"fullName": "John Doe",
|
|
"phone": "string",
|
|
"genderType": "string",
|
|
"birthday": "2024-01-01",
|
|
"createdAt": "2024-01-01T00:00:00Z",
|
|
"verifiedStatus": "string",
|
|
"company": "string",
|
|
"active": true,
|
|
"permission": {},
|
|
"tariffs": [],
|
|
"tariffInfo": {
|
|
"id": "number",
|
|
"tariffId": "number",
|
|
"tariffName": "string",
|
|
"tokens": "number",
|
|
"status": "ACTIVE",
|
|
"currentFileCounts": "number",
|
|
"maxFileCounts": "number",
|
|
"currentFileOnDisk": "number",
|
|
"maxFileOnDisk": "number",
|
|
"startTariff": "2024-01-01T00:00:00Z",
|
|
"endTariff": "2024-01-01T00:00:00Z"
|
|
}
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `404` - User not found
|
|
|
|
---
|
|
|
|
### 2. Change Password
|
|
**Endpoint:** `POST /v1/api/user/change-password`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Request Body:**
|
|
```json
|
|
{
|
|
"email": "user@example.com",
|
|
"oldPassword": "string",
|
|
"newPassword": "string"
|
|
}
|
|
```
|
|
|
|
**Response:** UserDTO object
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `400` - Invalid email
|
|
- `404` - User not found
|
|
|
|
---
|
|
|
|
### 3. Update User Profile
|
|
**Endpoint:** `PATCH /v1/api/user/user-update`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Request Body:**
|
|
```json
|
|
{
|
|
"fullName": "string",
|
|
"phone": "string",
|
|
"genderType": "string",
|
|
"birthday": "2024-01-01"
|
|
}
|
|
```
|
|
|
|
**Response:** Updated UserDTO
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `404` - User not found
|
|
|
|
---
|
|
|
|
### 4. Create New User
|
|
**Endpoint:** `POST /v1/api/user/create-user`
|
|
|
|
**Request Body:**
|
|
```json
|
|
{
|
|
"fullName": "John Doe",
|
|
"email": "user@example.com",
|
|
"phone": "string",
|
|
"password": "string"
|
|
}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"user": {
|
|
"id": "number",
|
|
"email": "string",
|
|
"fullName": "string"
|
|
},
|
|
"token": "jwt_token_string"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `409` - User already exists
|
|
|
|
---
|
|
|
|
### 5. Delete User
|
|
**Endpoint:** `DELETE /v1/api/user/delete-user/{userId}`
|
|
|
|
**Path Parameters:**
|
|
- `userId` (number, required) - User ID
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"userId": "number",
|
|
"deleted": "true"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
## Search Settings
|
|
|
|
### Base URL
|
|
```
|
|
/api/search/settings
|
|
```
|
|
|
|
### 1. Get Search Settings
|
|
**Endpoint:** `GET /api/search/settings`
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"messageDesc": "Success",
|
|
"messageBody": {
|
|
"engines": {
|
|
"yandex": true,
|
|
"google": true
|
|
},
|
|
"proxyEnabled": true
|
|
}
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 2. Update Search Settings
|
|
**Endpoint:** `PUT /api/search/settings`
|
|
|
|
**Request Body:**
|
|
```json
|
|
{
|
|
"engines": {
|
|
"yandex": true,
|
|
"google": false
|
|
},
|
|
"proxyEnabled": true
|
|
}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"messageDesc": "Settings updated"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
## Global Search
|
|
|
|
### Base URL
|
|
```
|
|
/api/v1/global-search
|
|
```
|
|
|
|
### 1. Start Global Search
|
|
**Endpoint:** `POST /api/v1/global-search/start`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Request Body:**
|
|
```json
|
|
{
|
|
"fileIds": ["string", "string"],
|
|
"engines": ["yandex", "google"],
|
|
"searchType": "visual_matches"
|
|
}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"taskId": "string",
|
|
"status": "ACCEPTED",
|
|
"totalFiles": "number"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `404` - Files not found
|
|
|
|
---
|
|
|
|
### 2. Get Current Task
|
|
**Endpoint:** `GET /api/v1/global-search/actual-task`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"taskId": "string",
|
|
"userId": "number",
|
|
"status": "PROCESSING",
|
|
"totalFiles": "number",
|
|
"processedFiles": "number",
|
|
"createdAt": "2024-01-01T00:00:00Z"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `404` - Task not found
|
|
|
|
---
|
|
|
|
### 3. Get Search Task Status
|
|
**Endpoint:** `GET /api/v1/global-search/status/{taskId}`
|
|
|
|
**Path Parameters:**
|
|
- `taskId` (string, required) - Task ID
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"taskId": "string",
|
|
"status": "PROCESSING",
|
|
"progress": 50
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `404` - Task not found
|
|
|
|
---
|
|
|
|
### 4. Get Violation Summary
|
|
**Endpoint:** `GET /api/v1/global-search/violation-summary`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Response:**
|
|
```json
|
|
[
|
|
{
|
|
"fileId": "string",
|
|
"fileName": "string",
|
|
"violationCount": "number",
|
|
"severity": "HIGH"
|
|
}
|
|
]
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `404` - No violations found
|
|
|
|
---
|
|
|
|
### 5. Get Violations with Pagination
|
|
**Endpoint:** `POST /api/v1/global-search/violation-summary-with-files`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Request Body:**
|
|
```json
|
|
{
|
|
"fileName": "string",
|
|
"sortDirection": "DESC",
|
|
"page": 0,
|
|
"size": 20,
|
|
"startDate": "2024-01-01T00:00:00Z",
|
|
"endDate": "2024-12-31T23:59:59Z"
|
|
}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"content": [],
|
|
"page": 0,
|
|
"size": 20,
|
|
"totalElements": 100,
|
|
"totalPages": 5,
|
|
"hasNext": true,
|
|
"hasPrevious": false
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
## Payments
|
|
|
|
### Base URL
|
|
```
|
|
/api/payments
|
|
```
|
|
|
|
### 1. Create Payment
|
|
**Endpoint:** `POST /api/payments/create`
|
|
|
|
**Query Parameters:**
|
|
- `email` (string, required) - User email
|
|
- `tariffId` (number, required) - Tariff ID
|
|
- `operationType` (string, required) - Type of operation
|
|
- `operationUuid` (string, required) - Operation UUID
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"id": "number",
|
|
"userId": "number",
|
|
"tariffId": "number",
|
|
"amount": "number",
|
|
"status": "PENDING",
|
|
"createdAt": "2024-01-01T00:00:00Z"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `404` - User or Tariff not found
|
|
- `500` - Internal server error
|
|
|
|
---
|
|
|
|
### 2. YooKassa Webhook
|
|
**Endpoint:** `POST /api/payments/webhook/yookassa`
|
|
|
|
**Request Body:**
|
|
```json
|
|
{
|
|
"type": "payment.succeeded",
|
|
"object": {
|
|
"id": "string",
|
|
"status": "succeeded",
|
|
"amount": {
|
|
"value": "string",
|
|
"currency": "RUB"
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 3. Change Auto-Renewal
|
|
**Endpoint:** `POST /api/payments/auto-renewal`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token (required)
|
|
|
|
**Query Parameters:**
|
|
- `renewal` (boolean, required) - Enable/disable auto-renewal
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"message": "Auto-renewal changed: true"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `400` - Invalid token
|
|
- `404` - User not found
|
|
|
|
---
|
|
|
|
### 4. Get Payment Methods
|
|
**Endpoint:** `GET /api/payments/methods`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token (required)
|
|
|
|
**Response:**
|
|
```json
|
|
[
|
|
{
|
|
"id": "string",
|
|
"type": "CARD",
|
|
"lastFour": "1234",
|
|
"isDefault": true
|
|
}
|
|
]
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `404` - User not found
|
|
|
|
---
|
|
|
|
### 5. Delete Payment Method
|
|
**Endpoint:** `DELETE /api/payments/methods/{paymentMethodId}`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token (required)
|
|
|
|
**Path Parameters:**
|
|
- `paymentMethodId` (string, required) - Payment method ID
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"message": "Payment method deleted"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `400` - Bad request
|
|
- `404` - User not found
|
|
|
|
---
|
|
|
|
## Payouts
|
|
|
|
### Base URL
|
|
```
|
|
/api/payouts
|
|
```
|
|
|
|
### 1. Create Payout Request
|
|
**Endpoint:** `POST /api/payouts/create-request`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Request Body:**
|
|
```json
|
|
{
|
|
"amount": "number",
|
|
"methodId": "number",
|
|
"description": "string"
|
|
}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"id": "number",
|
|
"userId": "number",
|
|
"amount": "number",
|
|
"status": "PENDING",
|
|
"createdAt": "2024-01-01T00:00:00Z"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `201` - Created
|
|
- `409` - Insufficient funds or pending payout exists
|
|
|
|
---
|
|
|
|
### 2. Process Payout Request
|
|
**Endpoint:** `POST /api/payouts/requests/{requestId}/process`
|
|
|
|
**Path Parameters:**
|
|
- `requestId` (number, required) - Payout request ID
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"id": "number",
|
|
"status": "PROCESSED",
|
|
"updatedAt": "2024-01-01T00:00:00Z"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 3. Cancel Payout Request
|
|
**Endpoint:** `POST /api/payouts/requests/{requestId}/cancel`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Path Parameters:**
|
|
- `requestId` (number, required) - Payout request ID
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"id": "number",
|
|
"status": "CANCELLED",
|
|
"updatedAt": "2024-01-01T00:00:00Z"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `404` - User or request not found
|
|
|
|
---
|
|
|
|
### 4. Get User Payout Requests
|
|
**Endpoint:** `GET /api/payouts/requests`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Response:**
|
|
```json
|
|
[
|
|
{
|
|
"id": "number",
|
|
"amount": "number",
|
|
"status": "PENDING",
|
|
"createdAt": "2024-01-01T00:00:00Z"
|
|
}
|
|
]
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `404` - User not found
|
|
|
|
---
|
|
|
|
### 5. Get Payout Request by ID
|
|
**Endpoint:** `GET /api/payouts/requests/{requestId}`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Path Parameters:**
|
|
- `requestId` (number, required) - Payout request ID
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"id": "number",
|
|
"userId": "number",
|
|
"amount": "number",
|
|
"status": "PENDING",
|
|
"methodId": "number"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `404` - User or request not found
|
|
|
|
---
|
|
|
|
### 6. Get Available Payout Methods
|
|
**Endpoint:** `GET /api/payouts/payout-methods`
|
|
|
|
**Response:**
|
|
```json
|
|
[
|
|
{
|
|
"code": "CARD",
|
|
"name": "Bank Card"
|
|
},
|
|
{
|
|
"code": "BANK_TRANSFER",
|
|
"name": "Bank Transfer"
|
|
}
|
|
]
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 7. Get User Payout Methods
|
|
**Endpoint:** `GET /api/payouts/user/payout-methods`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Response:**
|
|
```json
|
|
[
|
|
{
|
|
"id": "number",
|
|
"type": "CARD",
|
|
"lastFour": "1234",
|
|
"isDefault": true
|
|
}
|
|
]
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `404` - User not found
|
|
|
|
---
|
|
|
|
### 8. Add Card Payout Method
|
|
**Endpoint:** `POST /api/payouts/payout-method/card`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Request Body:**
|
|
```json
|
|
{
|
|
"cardNumber": "string",
|
|
"expiryMonth": "number",
|
|
"expiryYear": "number",
|
|
"cvv": "string"
|
|
}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"id": "number",
|
|
"type": "CARD",
|
|
"lastFour": "1234",
|
|
"isDefault": false
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `201` - Created
|
|
- `404` - User not found
|
|
|
|
---
|
|
|
|
### 9. Add Bank Transfer Payout Method
|
|
**Endpoint:** `POST /api/payouts/payout-method/bank-transfer`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Request Body:**
|
|
```json
|
|
{
|
|
"bankName": "string",
|
|
"accountNumber": "string",
|
|
"routingNumber": "string",
|
|
"accountHolder": "string"
|
|
}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"id": "number",
|
|
"type": "BANK_TRANSFER",
|
|
"lastFour": "0123",
|
|
"isDefault": false
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `201` - Created
|
|
- `404` - User not found
|
|
|
|
---
|
|
|
|
### 10. Set Default Payout Method
|
|
**Endpoint:** `PUT /api/payouts/payout-method/{methodId}/default`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Path Parameters:**
|
|
- `methodId` (number, required) - Payout method ID
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `404` - User not found
|
|
|
|
---
|
|
|
|
## Files
|
|
|
|
### Base URL
|
|
```
|
|
/api/files
|
|
```
|
|
|
|
### 1. Get Public File
|
|
**Endpoint:** `GET /api/files/public/{fileId}`
|
|
|
|
**Path Parameters:**
|
|
- `fileId` (string, required) - File ID
|
|
|
|
**Response:** File stream with appropriate headers
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `404` - File not found
|
|
- `500` - Internal server error
|
|
|
|
---
|
|
|
|
### 2. Get Public File Info
|
|
**Endpoint:** `GET /api/files/public/file-info/{fileId}`
|
|
|
|
**Path Parameters:**
|
|
- `fileId` (string, required) - File ID
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"id": "string",
|
|
"fileName": "string",
|
|
"fileSize": "number",
|
|
"mimeType": "string",
|
|
"createdAt": "2024-01-01T00:00:00Z"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `404` - File not found
|
|
|
|
---
|
|
|
|
### 3. Get Protected File
|
|
**Endpoint:** `GET /api/files/protected/{fileId}/{type}`
|
|
|
|
**Path Parameters:**
|
|
- `fileId` (string, required) - File ID
|
|
- `type` (string, required) - "file" or "thumbnail"
|
|
|
|
**Response:** File stream
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `400` - File is not protected
|
|
- `500` - File not found
|
|
|
|
---
|
|
|
|
### 4. Get File with Type
|
|
**Endpoint:** `GET /api/files/public/{fileId}/{type}`
|
|
|
|
**Path Parameters:**
|
|
- `fileId` (string, required) - File ID
|
|
- `type` (string, required) - "file" or "thumbnail"
|
|
|
|
**Response:** File stream
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `400` - File is not protected
|
|
|
|
---
|
|
|
|
### 5. Get Check Status
|
|
**Endpoint:** `GET /api/files/check-file/status/{userId}`
|
|
|
|
**Path Parameters:**
|
|
- `userId` (number, required) - User ID
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"userId": "number",
|
|
"checksRemaining": "number",
|
|
"checksUsed": "number",
|
|
"totalChecks": "number"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 6. Update Check Limit
|
|
**Endpoint:** `POST /api/files/check-file/update-limit/{userId}/{limit}`
|
|
|
|
**Path Parameters:**
|
|
- `userId` (number, required) - User ID
|
|
- `limit` (number, required) - New limit
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"userId": "number",
|
|
"limit": "number",
|
|
"updatedAt": "2024-01-01T00:00:00Z"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 7. Protect File
|
|
**Endpoint:** `POST /api/files/protect/{fileId}/{convertTo}`
|
|
|
|
**Path Parameters:**
|
|
- `fileId` (string, required) - File ID
|
|
- `convertTo` (string, required) - Convert format
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"id": "string",
|
|
"name": "string",
|
|
"path": "string",
|
|
"type": "string"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 8. Download Passport Zip
|
|
**Endpoint:** `GET /api/files/download/user-passport/archive/{userId}`
|
|
|
|
**Path Parameters:**
|
|
- `userId` (number, required) - User ID
|
|
|
|
**Response:** ZIP file stream
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `500` - Failed to assemble passport
|
|
|
|
---
|
|
|
|
## API Keys
|
|
|
|
### Base URL
|
|
```
|
|
/api/user
|
|
```
|
|
|
|
### 1. Create API Key
|
|
**Endpoint:** `POST /api/user/api-keys`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Request Body:**
|
|
```json
|
|
{
|
|
"name": "My API Key"
|
|
}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"messageCode": "number",
|
|
"messageDesc": "string",
|
|
"messageBody": {
|
|
"apiKey": "string"
|
|
}
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 2. List User API Keys
|
|
**Endpoint:** `GET /api/user/api-keys`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"messageCode": "number",
|
|
"messageBody": [
|
|
{
|
|
"id": "number",
|
|
"name": "string",
|
|
"prefix": "string",
|
|
"isActive": true,
|
|
"createdAt": "2024-01-01T00:00:00Z",
|
|
"lastUsedAt": "2024-01-01T00:00:00Z"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 3. Revoke API Key
|
|
**Endpoint:** `DELETE /api/user/api-keys/{keyId}`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Path Parameters:**
|
|
- `keyId` (number, required) - API Key ID
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"messageCode": "number"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
## Main API
|
|
|
|
### Base URL
|
|
```
|
|
/api
|
|
```
|
|
|
|
### 1. Handle API Request (Versioned)
|
|
**Endpoint:** `POST /api/v{version}/data`
|
|
|
|
**Path Parameters:**
|
|
- `version` (number, required) - API version (e.g., 1, 2)
|
|
|
|
**Request Body:**
|
|
```json
|
|
{
|
|
"msgId": "number",
|
|
"data": {}
|
|
}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"msgId": "number",
|
|
"code": "number",
|
|
"messageDesc": "string",
|
|
"messageBody": {}
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 2. Handle Auth Request
|
|
**Endpoint:** `POST /api/auth`
|
|
|
|
**Request Body:**
|
|
```json
|
|
{
|
|
"msgId": "number",
|
|
"data": {}
|
|
}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"msgId": "number",
|
|
"code": "number",
|
|
"messageDesc": "string"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 3. Internal Data Info
|
|
**Endpoint:** `POST /api/internal/data-info`
|
|
|
|
**Request Body:**
|
|
```json
|
|
{
|
|
"msgId": "number",
|
|
"data": {}
|
|
}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"msgId": "number",
|
|
"code": "number"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 4. Internal Data Download
|
|
**Endpoint:** `GET /api/internal/data-download/{fileId}`
|
|
|
|
**Path Parameters:**
|
|
- `fileId` (string, required) - File ID
|
|
|
|
**Response:** File bytes
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `404` - File not found
|
|
|
|
---
|
|
|
|
### 5. Internal Data Control
|
|
**Endpoint:** `POST /api/internal/data-control`
|
|
|
|
**Request Body:**
|
|
```json
|
|
{
|
|
"msgId": "number",
|
|
"data": {}
|
|
}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"msgId": "number",
|
|
"code": "number"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 6. Upload File Chunk
|
|
**Endpoint:** `POST /api/v{version}/files/chunk`
|
|
|
|
**Path Parameters:**
|
|
- `version` (number, required) - API version
|
|
|
|
**Query Parameters:**
|
|
- `upload_id` (string, required) - Upload session ID
|
|
- `chunk_number` (number, required) - Chunk number
|
|
- `chunk` (file, required) - Chunk file
|
|
- `findSimilar` (number, optional) - Find similar files flag
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"msgId": "number",
|
|
"code": "number",
|
|
"messageBody": {
|
|
"uploadId": "string",
|
|
"chunkNumber": "number",
|
|
"chunkSize": "number",
|
|
"fileId": "string",
|
|
"message": "Chunk uploaded successfully"
|
|
}
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `409` - Duplicate file
|
|
|
|
---
|
|
|
|
### 7. Upload Private File Chunk
|
|
**Endpoint:** `POST /api/v{version}/private/files/chunk`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Query Parameters:**
|
|
- `upload_id` (string, required) - Upload session ID
|
|
- `chunk_number` (number, required) - Chunk number
|
|
- `chunk` (file, required) - Chunk file
|
|
- `last_file` (boolean, optional) - Is this the last file
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"msgId": "number",
|
|
"code": "number",
|
|
"messageBody": {
|
|
"uploadId": "string",
|
|
"chunkNumber": "number",
|
|
"fileId": "string"
|
|
}
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 8. Check File
|
|
**Endpoint:** `GET /api/check/{fileId}`
|
|
|
|
**Path Parameters:**
|
|
- `fileId` (string, required) - File ID
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"msgId": "number",
|
|
"code": "number",
|
|
"messageBody": {
|
|
"fileId": "string",
|
|
"checkResult": {}
|
|
}
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 9. Find Similar Files
|
|
**Endpoint:** `GET /api/v{version}/files/{fileId}/similar`
|
|
|
|
**Path Parameters:**
|
|
- `version` (number, required) - API version
|
|
- `fileId` (string, required) - File ID
|
|
|
|
**Query Parameters:**
|
|
- `similarityLevels` (array, optional) - Similarity level filters
|
|
- `page` (number, optional, default: 0) - Page number
|
|
- `size` (number, optional, default: 20) - Page size
|
|
- `sort` (string, optional, default: "hammingDistance") - Sort field
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"msgId": "number",
|
|
"code": "number",
|
|
"messageBody": {
|
|
"content": [
|
|
{
|
|
"fileId": "string",
|
|
"fileName": "string",
|
|
"similarity": "number"
|
|
}
|
|
],
|
|
"page": "number",
|
|
"size": "number",
|
|
"totalElements": "number",
|
|
"totalPages": "number",
|
|
"hasNext": "boolean"
|
|
}
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `400` - Invalid file
|
|
|
|
---
|
|
|
|
### 10. Get Upload Progress
|
|
**Endpoint:** `GET /api/v{version}/files/progress/{uploadId}`
|
|
|
|
**Path Parameters:**
|
|
- `version` (number, required) - API version
|
|
- `uploadId` (string, required) - Upload ID
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"msgId": "number",
|
|
"code": "number",
|
|
"messageBody": {
|
|
"uploadId": "string",
|
|
"fileName": "string",
|
|
"totalChunks": "number",
|
|
"uploadedChunks": "number",
|
|
"status": "UPLOADING",
|
|
"progressPercentage": "number",
|
|
"filePath": "string",
|
|
"remainingChunks": "number"
|
|
}
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 11. Complete Upload
|
|
**Endpoint:** `POST /api/v{version}/files/{uploadId}/complete`
|
|
|
|
**Path Parameters:**
|
|
- `version` (number, required) - API version
|
|
- `uploadId` (string, required) - Upload ID
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"msgId": "number",
|
|
"code": "number",
|
|
"messageBody": {
|
|
"uploadId": "string",
|
|
"status": "COMPLETED",
|
|
"uploadedChunks": "number",
|
|
"totalChunks": "number",
|
|
"message": "File assembly in progress",
|
|
"filePath": "string"
|
|
}
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 12. Download Public File
|
|
**Endpoint:** `GET /api/v{version}/files/public-download/{fileId}`
|
|
|
|
**Path Parameters:**
|
|
- `version` (number, required) - API version
|
|
- `fileId` (string, required) - File ID
|
|
|
|
**Response:** File bytes
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `400` - File is blocked or no download permission
|
|
|
|
---
|
|
|
|
### 13. Download File with Auth
|
|
**Endpoint:** `GET /api/v{version}/files/download/{fileId}`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token (required)
|
|
|
|
**Path Parameters:**
|
|
- `version` (number, required) - API version
|
|
- `fileId` (string, required) - File ID
|
|
|
|
**Response:** File bytes
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `400` - File is blocked
|
|
- `401` - Invalid token
|
|
- `403` - No permission
|
|
|
|
---
|
|
|
|
### 14. Get File Link
|
|
**Endpoint:** `POST /api/file/link`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token (optional)
|
|
|
|
**Request Body:**
|
|
```json
|
|
{
|
|
"fileId": "string",
|
|
"viewerIp": "string",
|
|
"viewerUserAgent": "string"
|
|
}
|
|
```
|
|
|
|
**Response:** File bytes with download headers
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
- `400` - File is blocked
|
|
|
|
---
|
|
|
|
### 15. Get File Protection Stats
|
|
**Endpoint:** `GET /api/check/file_stats`
|
|
|
|
**Headers:**
|
|
- `Authorization` - JWT token with userId
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"imageProtections": "number",
|
|
"documentProtections": "number",
|
|
"audioProtections": "number",
|
|
"totalProtections": "number"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
## Health Check
|
|
|
|
### Base URL
|
|
```
|
|
check/api
|
|
```
|
|
|
|
### 1. Health Check
|
|
**Endpoint:** `GET /check/api/healt`
|
|
|
|
**Response:** HTTP Status OK
|
|
|
|
**Status Codes:**
|
|
- `200` - Service is healthy
|
|
|
|
---
|
|
|
|
### 2. Get Build Info
|
|
**Endpoint:** `GET /check/api/build`
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"buildTimeBack": "string"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 3. Get Memory Info
|
|
**Endpoint:** `GET /check/api/api/debug/memory`
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"maxMemory (MB)": "string",
|
|
"totalMemory (MB)": "string",
|
|
"freeMemory (MB)": "string",
|
|
"usedMemory (MB)": "string",
|
|
"availableProcessors": "string",
|
|
"JAVA_TOOL_OPTIONS": "string",
|
|
"JAVA_OPTS": "string"
|
|
}
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 4. Test Monitoring
|
|
**Endpoint:** `POST /check/api/test/monitoring/{fileId}`
|
|
|
|
**Path Parameters:**
|
|
- `fileId` (string, required) - File ID
|
|
|
|
**Response:**
|
|
```json
|
|
"OK"
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
## Migration
|
|
|
|
### Base URL
|
|
```
|
|
/api/admin/migration
|
|
```
|
|
|
|
### 1. Start Migration
|
|
**Endpoint:** `POST /api/admin/migration/start`
|
|
|
|
**Response:**
|
|
```
|
|
Migration started. Check logs for progress.
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 2. Get Migration Status
|
|
**Endpoint:** `POST /api/admin/migration/status`
|
|
|
|
**Response:**
|
|
```
|
|
Check application logs and migration_failed.txt for details
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
### 3. Fill Dock View
|
|
**Endpoint:** `POST /api/admin/migration/fill-dock-view`
|
|
|
|
**Response:**
|
|
```
|
|
fill old dock view
|
|
```
|
|
|
|
**Status Codes:**
|
|
- `200` - Success
|
|
|
|
---
|
|
|
|
## Error Handling
|
|
|
|
### Common Error Codes
|
|
|
|
| Code | Description |
|
|
|------|-------------|
|
|
| `200` | Success |
|
|
| `201` | Created |
|
|
| `400` | Bad Request / Invalid parameters |
|
|
| `401` | Unauthorized |
|
|
| `403` | Forbidden / No permission |
|
|
| `404` | Not Found |
|
|
| `409` | Conflict / Resource already exists |
|
|
| `500` | Internal Server Error |
|
|
|
|
### Error Response Format
|
|
|
|
```json
|
|
{
|
|
"messageCode": "number",
|
|
"messageDesc": "string",
|
|
"messageBody": {
|
|
"error": "string",
|
|
"message": "string"
|
|
}
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Authentication
|
|
|
|
Most endpoints require JWT authentication via the `Authorization` header:
|
|
|
|
```
|
|
Authorization: Bearer <jwt_token>
|
|
```
|
|
|
|
The JWT token should contain the `userId` claim, which is extracted from the request attributes.
|
|
|
|
---
|
|
|
|
## Request/Response Headers
|
|
|
|
### Common Request Headers
|
|
- `Content-Type`: `application/json`
|
|
- `Authorization`: `Bearer <jwt_token>` (where required)
|
|
|
|
### Common Response Headers
|
|
- `Content-Type`: `application/json` or `application/octet-stream` (for file downloads)
|
|
- `Cache-Control`: Cache directives
|
|
- `Content-Disposition`: For file downloads
|
|
|
|
---
|
|
|
|
## Rate Limiting
|
|
|
|
Currently, there are no documented rate limits. Please contact support for information about rate limiting policies.
|
|
|
|
---
|
|
|
|
## Versioning
|
|
|
|
The API uses URL versioning. Different endpoints may use different versions:
|
|
- `/v1/api/...` - Version 1
|
|
- `/api/v{version}/...` - Dynamic versioning
|
|
|
|
---
|
|
|
|
## Date Format
|
|
|
|
All dates and timestamps should use ISO 8601 format:
|
|
```
|
|
2024-01-01T00:00:00Z
|
|
```
|
|
|
|
---
|
|
|
|
*Last Updated: 2026-07-01*
|