rest - 在 GoLang 中寻找 Soundcloud API 的入门资源

标签 rest go soundcloud

我尝试使用 Go 访问 Soundcloud API 但未成功。对于 Soundcloud 不直接支持的任何语言,它们的 API 都非常复杂。如果有人有任何资源或代码示例,如果有人与我分享,我将不胜感激。

我的代码如下:

func main() {
    v := url.Values{}
    v.Set("scope", "non-expiring")
    v.Set("client_id", auth.ClientID)
    v.Set("response_type", "code")
    v.Set("redirect_uri", auth.RedirectURI)

    c.AuthURL = AuthEndpoint + "?" + v.Encode()
    c.Values = v.Encode()

    res := c.Request("POST", url.Values{})
}



func (c *Client) Request(method string, params url.Values) []byte {
    params.Set("client_id", "*************")

    reqUrl := "https://api.soundcloud.com/oauth2/token"

    req, _ := http.NewRequest(method, reqUrl, strings.NewReader(c.Values))
    req.Header.Add("Accept", "application/json")
    resp, _ := c.client.Do(req)

    defer resp.Body.Close()

    body, _ := ioutil.ReadAll(resp.Body)

    return body
}

最佳答案

我正在积极开发一个包来访问/使用 Soundcloud API,它支持 OAuth2,并且已经可用。

我邀请你去寻找它。 https://github.com/njasm/gosoundcloud

考虑到该包仍在大量开发中,API 将来可能会发生变化。

关于rest - 在 GoLang 中寻找 Soundcloud API 的入门资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25213449/

相关文章:

javascript - Soundcloud Api/转发端点

rest - Camel cxfrs RESTful 客户端/ProducerTemplate ConnectionTimeout

java - 从 REST 中的资源路径获取占位符值?

python - 谷歌翻译API超时

php - CI REST 服务器 API key

file - gzip Reader.Close 的意义何在?

validation - go 是否提供变量清理?

go - 通过 LDAP 查询来自 Active Directory 的 IP 地址的用户信息?

ios - SoundCloud API 是否在没有通知的情况下发生了变化?

javascript - Soundcloud:检测缺少的 localStorage 支持并通知用户