Downloading a file from Yandex Disk
To download a file from Yandex Disk:
- Request a download URL.
- Download the file from the address, using the same OAuth token as in the original request.
Download URL request
To get a direct download URL, send the current file path on Yandex Disk to the API.
Request format
Use the GET method to send a request for a download URL.
https://cloud-api.yandex.net/v1/disk/resources/download
? path=<path to the file being downloaded>
& [fields=<properties to include in the response>]
- path*
-
The path to the file being downloaded. For example,
%2Fbar%2Fphoto.png
.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 200 OK
code. The Link object in the response body contains the URL generated to download the file. The URL has a limited lifetime.
If the request caused an error, the relevant response code is returned, and the response body contains an error description.
Sample response:
{
"href": "https://downloader.dst.yandex.ru/disk/...",
"method": "GET",
"templated": false
}
Element |
Description |
|
URL. It may be a URL template. See the |
|
The HTTP method for requesting the URL from the |
|
Indicates a URL template according to RFC 6570. Possible values:
|
Downloading a file from a given URL
Use the GET method to download the file:
https://downloader.dst.yandex.ru/disk/53139aa0et584d3bac7eeab405d3574b/535320b4/YyjTJtEHob8R5WbpojJbiiUuU2HC_2JSTU0gW9qE0NHGW2uncmBjM_-IXun3Msyij96FTHQGSX-fDL-XwokDvA%3D%3D?uid=202727674&filename=photo.png&disposition=attachment&hash=&limit=0&content_type=application%2Fx-www-form-urlencoded&fsize=34524&hid=93528043563b8r55723a253f4730290a&media_type=document
If the request is processed without errors, the API returns the 200 OK
code.
The path to the file being downloaded. For example, %2Fbar%2Fphoto.png
.
The path in the parameter value should be encoded in URL format.
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.