Create a file system directory

NAS File Storage REST API v7 Reference

Version
14.7.x
14.6.x
Audience
anonymous
Part Number
MK-92HNAS088-05

Creates a file system directory.

HTTP request syntax (URI)

POST <base_URI>/v7/storage/filesystems/{id}/directories

Parameters

Name Type Required Values Description
id URI_PARAM Y string Specifies either the object ID of the file system or the HNAS file system ID to create a directory.
directory BODY Y string Full path of the directory to be created. The path should be in UNIX format.
ensureCreate BODY Y boolean When set to TRUE, the end result is similar to the mkdir -p command, which allows creating a directory even if its parent directory does not exist. For example, if /example does not exist in the file system, and directory has the value /example/subdirectory and the ensureCreate parameter is set to TRUE, then this operation can succeed.

Return codes

Code Data Description
201 directory File system directory has been successfully created.
400 No Data Missing or invalid request contents.
404 Error Message Requested resource not found.
500 Error message Error associated with the storage system.
501 No Data Server has not implemented the request operation on the resource.

Any HTTP status code other than 201 indicates that the API did not complete successfully.

Request example: Using the file system object ID

curl -vk -H "X-Api-Key: zrxvSDAv9x.RIP4gkmKarG3beF.or.4Tc2im7oeqYN88C9XPGHxbXC" https://172.17.57.75:8444/v7/storage/filesystems/4141394239423945344644383541464430303030303030303030303030303030/directories -d ‘{"directory":"/new6/test/test4", "ensureCreate":true}’ -X POST

Response example: Using the file system object ID

HTTP/1.1 201 Created
{
   "directory" : {
      "displayName" : [ "//new6/test/test4" ],
      "objectId" : "73657368616e6577362f746573742f7465737434"
   },
   "uri" : "https://172.17.58.108.8444/v7/storage/filesystems/4141394239423945344644383541464430303030303030303030303030303030/directories/73657368616e6577362f746573742f7465737434"
}

Request example: Using the HNAS storage file system ID

curl -vk -H "X-Api-Key: zrxvSDAv9x.RIP4gkmKarG3beF.or.4Tc2im7oeqYN88C9XPGHxbXC" https://172.17.57.75:8444/v7/storage/filesystems/864DC6E1DFB68C210000000000000000/directories -d ‘{"directory":"/new6/test/test4", "ensureCreate":true}’ -X POST

Response example: Using the HNAS storage file system ID

HTTP/1.1 201 Created
{
   "directory" : {
      "displayName" : [ "//new6/test/test4" ],
      "objectId" : "73657368616e6577362f746573742f7465737434"
   },
   "uri" : "https://172.17.58.108:8444/v7/storage/filesystems/4141394239423945344644383541464430303030303030303030303030303030/directories/73657368616e6577362f746573742f7465737434"
}