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
X-IBM-Target-System = <string>
This header indicates the target system name (nick name) for this request, where the system name
(nick name) is defined in the local system Systems table. The target host system must support
single-sign-on by using either an LTPA token or a valid X-IBM-Target-System-UserandX-IBM-Target-System-Passwordis provided for the target system. If the target system is the local system, this header is ignored and has no effect.
X-IBM-Target-System-User
This header indicates the z/OS user ID that allows the user to access the target system. If the
X-IBM-Target-Systemheader is not supplied, this header is ignored. BothX-IBM-Target-System-PasswordandX-IBM-Target-System-Usermust be provided together; otherwise, this header is ignored.If this header is not provided in the current request, the current request uses the authenticated user credentials to access the target system if either of the following conditions are true:- The
X-IBM-Target-System-Userheader was provided in a previous request - The service described in Authenticate with a secondary z/OSMF instance was issued in a previous request.

- The
X-IBM-Target-System-Password
This header indicates the password that is associated with the z/OS user ID. If the
X-IBM-Target-Systemheader is not supplied, this header is ignored. BothX-IBM-Target-System-PasswordandX-IBM-Target-System-Usermust be provided together; otherwise, this header is ignored.
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.
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