Skip to content

Add Directory API

API Information

  • Request Path: /datafile/add/dir
  • Request Method: POST
  • Content-Type: application/json

Request Headers

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

Request Body Structure

DirInfoReq Object

FieldTypeRequiredDescriptionConstraints
useridStringYesUser IDMust be a valid user ID
dirNameStringYesDirectory nameMust be unique within parent directory
parentIdLongYesParent directory IDMust be a valid directory ID

Request Body Example

json
{
  "userid": "user123",
  "dirName": "new_folder",
  "parentId": 12345
}

Response Body

FieldTypeDescription
codeIntegerResponse status code
messageStringResponse message
dataLongCreated directory ID

Response Examples

Success Response

json
{
  "code": 200,
  "message": "success",
  "data": 12346
}

Failure Response

json
{
  "code": 400,
  "message": "Directory name already exists",
  "data": null
}

Error Code Description

Error CodeDescription
200Success
400Request parameter error
401Unauthorized
404Parent directory not found
500Server internal error

Usage Instructions

  1. This API is used to create a new directory
  2. User authentication is required
  3. Directory name and parent ID are required
  4. Returns the ID of the created directory

Notes

  • Directory name is required and must be unique within the parent directory
  • Parent ID must reference an existing directory (use null for root)
  • User authentication token must be included in request headers