Appearance
Add Directory API
API Information
- Request Path:
/datafile/add/dir - 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
DirInfoReq Object
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| userid | String | Yes | User ID | Must be a valid user ID |
| dirName | String | Yes | Directory name | Must be unique within parent directory |
| parentId | Long | Yes | Parent directory ID | Must be a valid directory ID |
Request Body Example
json
{
"userid": "user123",
"dirName": "new_folder",
"parentId": 12345
}Response Body
| Field | Type | Description |
|---|---|---|
| code | Integer | Response status code |
| message | String | Response message |
| data | Long | Created 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 Code | Description |
|---|---|
| 200 | Success |
| 400 | Request parameter error |
| 401 | Unauthorized |
| 404 | Parent directory not found |
| 500 | Server internal error |
Usage Instructions
- This API is used to create a new directory
- User authentication is required
- Directory name and parent ID are required
- 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