Appearance
Copy File API
API Information
- Request Path:
/datafile/file/copy - Request Method:
POST - Content-Type:
application/json
Request Headers
| Parameter | Type | Required | Description |
|---|---|---|---|
| Authorization | String | Yes | User authentication token |
| Content-Type | String | Yes | Must be set to application/json |
Request Body Structure
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| sourceFileId | Long | Yes | Source file ID | Must exist |
| targetParentId | Long | Yes | Target parent directory ID | Must exist |
Request Body Example
json
{
"sourceFileId": 12345,
"targetParentId": 67890
}Response Body
| Field | Type | Description |
|---|---|---|
| code | Integer | Response status code |
| message | String | Response message |
| data | Long | Copied file ID |
Response Examples
Success Response
json
{
"code": 200,
"message": "success",
"data": 12346
}Failure Response
json
{
"code": 404,
"message": "Source file not found",
"data": null
}Error Code Description
| Error Code | Description |
|---|---|
| 200 | Success |
| 400 | Request parameter error |
| 401 | Unauthorized |
| 404 | Source file not found |
| 500 | Server internal error |
Usage Instructions
- This API is used to copy a file to a new location
- User authentication is required
- Source file ID and target parent ID must be provided
- Returns the ID of the copied file
Notes
- Source file ID must reference an existing file
- Target parent ID must reference an existing directory
- Creates a new file with the same content in the target location
- User authentication token must be included in request headers