【问题标题】:SoundCloud API wrapper, how to find a users favorites in JAVA?SoundCloud API 包装器,如何在 JAVA 中找到用户的收藏夹?
【发布时间】:2016-04-13 20:04:02
【问题描述】:

我在 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);

    }
}

【问题讨论】:

    标签: java api wrapper soundcloud


    【解决方案1】:

    查看 me 端点的开发者文档

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-10
      • 2023-03-20
      • 1970-01-01
      • 2013-10-20
      • 1970-01-01
      相关资源
      最近更新 更多