Creating a folder

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

Request format

Use the PUT method to send the request for creating a folder.

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

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

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

fields

List of JSON properties to include in the response. Keys not specified in this list are omitted when generating a response. If the parameter isn't specified, the response is returned in full without omitting anything.

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

* Required parameter.

Response format

If the request is processed without errors, the API returns the 201 Created (folder successfully created). The response body contains a link to meta information about the created resource in the Link object.

If the request caused an error, the relevant response code is returned, and the response body contains an error description.

Sample response:

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

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. To send a request to this address, replace the placeholder values in the curly brackets with the parameter values.
  • "false" — The URL can be requested without changes.