Skip to content

Copy File API ​

API Information ​

  • Request Path: /datafile/file/copy
  • Request Method: POST
  • Content-Type: application/json

Request Headers ​

ParameterTypeRequiredDescription
AuthorizationStringYesUser authentication token
Content-TypeStringYesMust be set to application/json

Request Body Structure ​

FieldTypeRequiredDescriptionConstraints
sourceFileIdLongYesSource file IDMust exist
targetParentIdLongYesTarget parent directory IDMust exist

Request Body Example ​

json
{
  "sourceFileId": 12345,
  "targetParentId": 67890
}

Response Body ​

FieldTypeDescription
codeIntegerResponse status code
messageStringResponse message
dataLongCopied 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 CodeDescription
200Success
400Request parameter error
401Unauthorized
404Source file not found
500Server internal error

Usage Instructions ​

  1. This API is used to copy a file to a new location
  2. User authentication is required
  3. Source file ID and target parent ID must be provided
  4. 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