0

我想要的只是做一个这样的帖子:

只要您拥有 publish_actions 权限,您就可以使用应用程序 access_token 向 /USER_ID/scores 发出 HTTP POST 请求来发布分数或用户。

名称 描述 类型 要求的分数 数值大于 0 的分数。整数 是

我正在这样做:

try {
    http.request( POST, URLENC ) {
        uri.path = "/100000781309474/scores?" + user.accessToken 
        body =  [score:10]

        response.success = { resp ->
            println "Tweet response status: ${resp.statusLine}"
            assert resp.statusLine.statusCode == 200
        }

        response.failure = { resp ->
            println "Unexpected error: ${resp.status} : ${resp.statusLine.reasonPhrase}"
        }
    }
} catch ( HttpResponseException ex ) {
    // default failure handler throws an exception:
    println "Unexpected response error: ${ex.statusCode}"
}

但它返回了这个异常:

400: Bad request

这意味着 POST 不正确,是吗?

有人能告诉我如何用用户分数做帖子吗?

4

1 回答 1

1

参考https://developers.facebook.com/docs/score/

我首先看到您正在传递用户令牌

uri.path = "/100000781309474/scores?" + user.accessToken

它应该是应用访问令牌。格式为http://graph.facebook.com/{userId}/scores?access_token={AppAccessToken}参数名称score和值{theirScore}。确保 access_token 是应用访问令牌。还要确保您的应用已注册为游戏应用。

于 2012-01-22T19:19:55.050 回答