Creating a folder

To create a folder on Yandex.Disk, specify the desired path to the new folder.

Request format

Use the PUT method to send the request to create a folder.

https://cloud-api.yandex.net/v1/disk/resources
 ? path=<path to the created folder>
 & [fields=<properties to include in the response>]
Query parameters
path *

The path to the folder being created. For example, to create a Music folder in the Yandex.Disk root directory, set %2FMusic for the parameter (the maximum length of the folder name is 255 characters; the maximum length of the path is 32760 characters).

The path in the parameter value should be URL-encoded.

fields

List of JSON keys to include in the response. Keys that are not included in this list will be discarded when forming the response. If the parameter is omitted, the response is returned in full, without discarding anything.

Key names should be comma-separated, and embedded keys should be separated by dots. For example: name, _embedded. items. path.

*  Required

Response format

If the request was processed without errors, the API responds with the code 201 Created (the folder was created successfully). The response body contains a link to metainformation about the created resource in the Link object.

If an error occurred during processing, the appropriate response code is returned, and the response body contains the error description.

Sample response:

{
  "href": "https://cloud-api.yandex.net/v1/disk/resources?path=disk%3A%2FMusic",
  "method": "GET",
  "templated": false
}
Response elements
Element Description
href

URL. It may be a URL template; see the templated key.

method

The HTTP method for requesting the URL from the href key.

templated

Indicates a URL template according to RFC 6570. Possible values:

  • “true” — URL template. Before sending a request to this address, put the desired parameter values in place of the values in curly brackets.
  • “false” — The URL can be requested without changes.