Java (for Android and J2SE)

SDK source code: https://github.com/yandex-disk/yandex-disk-restapi-java

In addition to the library code, the SDK contains a sample application that implements several calls to the Yandex.Disk API, and code for testing it. The demo application requires Android version 4.0.3, but you can use the SDK with earlier OS versions.

Enabling the SDK

You can import the Maven project for using SDK calls in your app: http://mvnrepository.com/artifact/com.yandex.android/disk-restapi-sdk.

The SDK uses the Retrofit, Gson, and OkHttp libraries, which are connected automatically via the dependencies listed in the project.

Authorization in Yandex.Disk

With Android, you can request an OAuth token using the API Account Manager — this feature is used in the sample app. If the necessary Yandex account is not on the phone, the app displays the oauth.yandex.ru web interface. The user must log in on Yandex in order to grant the app access to files on Yandex.Disk.

Actions with Yandex.Disk

To access Yandex.Disk, you must use a RestClient class object.

All the Yandex.Disk functions supported by the SDK are implemented in the methods for this class: