SoundCloud API包装器,如何在JAVA中找到用户的最爱?

时间:2016-04-13 20:04:03

标签: java api wrapper soundcloud

我已经在java中编写了代码,用于创建包装器的实例并验证用户的帐户的电子邮件和密码,但是对于java SoundCloud API的停止支持我似乎无法找到获取用户的方法“喜欢这一点,我查阅了所有的文档和示例,但实施时似乎都没有。

PS。我更改了客户端ID,客户端密码以及安全性的用户名和密码,因此请在代码中忽略它。

import com.soundcloud.api.ApiWrapper;
import com.soundcloud.api.Token;
import java.io.File;

/**
* Creates an API wrapper instance, obtains an access token and serializes the
* wrapper to disk. The serialized wrapper can then be used for subsequent
* access to resources without re-authenticating
*
* @see GetResource
*/
public final class CreateWrapper {

public static final File WRAPPER_SER = new File("wrapper.ser");

public static void main(String[] args) throws Exception {

    final ApiWrapper soundCloud = new ApiWrapper(
            "client_id", /*client id*/
            "client_secret" /* client_secret */,
            null /* redirect URI */,
            null /* token */);

    Token token;

    token = soundCloud.login("username@username.com" /* login */, "password" /* password */);

    System.out.println("got token from server: " + token);

    // in this example the whole wrapper is serialised to disk -
    // in a real application you would just save the tokens and usually have the client_id/client_secret
    // hardcoded in the application, as they rarely change
    soundCloud.toFile(WRAPPER_SER);

    System.out.println("wrapper serialised to " + WRAPPER_SER);

    }
}

1 个答案:

答案 0 :(得分:0)

查看me端点的开发人员文档

/ users中记录的所有子资源也可以通过/ me获得。例如/ me / tracks将返回用户拥有的曲目。此外,您可以通过/ me / activities访问用户仪表板活动,并通过/ me / connections访问他或她连接的外部帐户。

https://developers.soundcloud.com/docs/api/reference#me

GET / users / {id} /收藏夹用户收藏的曲目列表