Updated on 2024-11-13 GMT+08:00

Creating a Directory

Function

This API is used to create a directory.

URI

POST /v1/{project_id}/sfs-turbo/shares/{share_id}/fs/dir

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

share_id

Yes

String

File system ID

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Account token

Content-Type

Yes

String

MIME type

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

path

Yes

String

Valid full path of an existing directory

mode

No

Long

Directory permissions, which range from 0 to 777*. The default value is 755. The first digit indicates the permissions of the directory owner, and its value ranges from 0 to 7. The second digit indicates the permissions of the user group to which the directory belongs, and its value ranges from 0 to 7. The third digit indicates the permissions of other users, and its value ranges from 0 to 7. The directory owner is specified by UID, and the user group to which the directory belongs is specified by GID. Users who are not the directory owner and not in the user group to which the directory belongs are other users. For example, in 755, the first digit 7 indicates that the directory owner has the read, write, and execute permissions on the directory, the second digit 5 indicates that the user group to which the directory belongs has the read and execute permissions on the directory, and the third digit 5 indicates that other users have the read and execute permissions on the directory.

uid

No

Long

ID of the directory owner. The default value is 0. The value ranges from 0 to 4,294,967,294 (2^32-2).

gid

No

Long

ID of the user group to which the directory belongs. The default value is 0. The value ranges from 0 to 4,294,967,294 (2^32-2).

Response Parameters

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

errCode

String

Error code

errMsg

String

Error description

Status code: 409

Table 5 Response body parameters

Parameter

Type

Description

errCode

String

Error code

errMsg

String

Error description

Status code: 500

Table 6 Response body parameters

Parameter

Type

Description

errCode

String

Error code

errMsg

String

Error description

Example Requests

Creating a directory whose full path is /date/test

{
  "path" : "/date/test"
}

Example Responses

Status code: 400

Error response

{
  "errCode" : "SFS.TURBO.0122",
  "errMsg" : "invalid mode"
}

Status code: 409

Conflict directory

{
  "errCode" : "SFS.TURBO.0114",
  "errMsg" : "path already exist"
}

Status code: 500

Error response

{
  "errCode" : "SFS.TURBO.0005",
  "errMsg" : "Internal server error"
}

Status Codes

Status Code

Description

204

Directory created

400

Error response

409

Conflict directory

500

Error response

Error Codes

See Error Codes.