Create a UNIX file or directory
You can use this operation to create a UNIX file or directory.
HTTP method and URI path
POST /zosmf/restfiles/fs/<file-path>
- /zosmf/restfiles specifies the z/OS® data set and file REST interface
- /fs indicates a UNIX file or directory.
- <file-path> is the name of the file or directory you are going to create.
Request Body
The request body to create a UNIX file or directory is shown in Request body to create a UNIX file or directory.
Field | Type | Description |
---|---|---|
type | String | The request type. This field supports the values: directory or dir to create a directory. The value: file is supported to create a file. |
mode | String | Specifies the file or directory permission bits to be used in creating the file or directory.
The characters used to describe permissions are: r: Permission to read the file w: Permission to write on the file x: Permission to execute the file -: No permission An example would be: rwxrwxrwx The nine characters are in three groups of three; they describe the permissions on the file or directory. The first group of 3 describes owner permissions; the second describes group permissions; the third describes other (or world) permissions. |
Standard headers
None.
Custom headers
None.
Query parameters
None.Content type
The content type is application/json.
Required authorizations
Usage considerations
Expected response
On completion, the service returns an HTTP response, which includes a status code indicating whether your request completed. Status code 201 indicates success. A status code of 4nn or 5nn indicates that an error has occurred. For more details, see Error handling.
For a successful create request, 201 Created is returned instead of returning an array of matching data sets.
Example request
POST /zosmf/restfiles/fs/u/jiahj/text.txt HTTP/1.1
Request body:
{"type":"file","mode":"RWXRW-RW-"}
Example response
201 Created
Content-Type: application/json; charset=UTF-8
Content-Length: 0
Date: Wed, 30 Sep 2015 11:46:21 GMT
Example request
POST /zosmf/restfiles/fs/u/jiahj/testDir HTTP/1.1
Request body
{"type":"directory","mode":"rwxr-xrwx"}
Example response
201 Created
Content-Type: application/json; charset=UTF-8
Content-Length: 0
Date: Date: Wed, 30 Sep 2015 10:50:21 GMT