Downloading a file from Yandex.Disk
To download a file from Yandex.Disk:
- Download the file from the address you were given, indicating the same OAuth token as in the original request.
Request for a download URL
Request format
Use the GET method to send the request for a download URL.
https://cloud-api.yandex.net/v1/disk/resources/download
? path=<path to the file to download>
& [fields=<properties to include in the response>]
path * | The path to the file to download. For example, %2Fbar%2Fphoto.png 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: |
path * | The path to the file to download. For example, %2Fbar%2Fphoto.png 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: |
* Required
Response format
If the request was processed without errors, the API responds with the code 200 OK
. The Link object in the response body returns the generated URL for downloading the file.
If the request caused an error, the relevant response code is returned, and the response body contains the error description.
Sample response:
{ "href": "https://downloader.dst.yandex.ru/disk/...", "method": "GET", "templated": false}
Element | Description |
---|---|
href | URL. It may be a URL template; see the |
method | The HTTP method for requesting the URL from the |
templated | Indicates a URL template according to RFC 6570. Possible values:
|
Element | Description |
---|---|
href | URL. It may be a URL template; see the |
method | The HTTP method for requesting the URL from the |
templated | Indicates a URL template according to RFC 6570. Possible values:
|
Downloading a file from the given URL
Use the GET method to download a 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 was processed without errors, the API responds with a file with the code 200 OK
.