我想尝试不像用户已经喜欢的Facebook提要

时间:2015-04-30 14:27:44

标签: java android facebook facebook-graph-api facebook-like

在Android应用程序中,我试图与用户已经喜欢的Facebook Feed不同,但我得到了#34; HTTP / 1.1 400 Bad Request"。我认为这可能是我的网址中存在的一些错误,我的网址是" https://graph.facebook.com/469111716576852_453729238115100/likes&access_token=CAANGZCSfBfk0BALIuBqJjRxVcwmr0t8nzm3rxC"

我已经给出了publish_actions和publish_stream权限

我指的是" How to unlike a post that a user has liked in facebook in android"

的确切代码
String postURL = FacebookAppConstants.GRAPH_API_ACCESS+"/"+postID+
        "/likes&access_token="+FacebookAppConstants.accessToken;

Log.out(logFlag, logTag, "########Delete URL = "+postURL);

HttpGet dislikePost = new HttpGet(postURL+"&method=DELETE");


try {
    HttpResponse response = httpClient.execute(dislikePost);
    HttpEntity entity = response.getEntity();
    String body = EntityUtils.toString(entity);
    Log.out(logFlag, logTag, "Body : "+body);           

} catch (ClientProtocolException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

我的回复是:

性反应的身体{"错误" {"消息":"未知路径组件:/喜欢&安培;的access_token = CAANGZCSfBfk0BAP1Kiu1dRCpcZAVbDd0nZAJZCpZCkTtk3Fx3BqvmU9uzpwpsSSMofWWxmZAoeMFd0VjaeSgzZCGYYPQKoR3dCjIEkyzlQkIrg0pZAYHRwZB5irFvKWtjasut6htyl9U0ZCj3GVI2LOH46BXlHkZBX3d8gz9xijYuAhHD52A1rWShxq7FKEyuh9sBF9RY0cKUP2YKgcjABAXcGM""类型&#34 ;:" OAuthException""代码":2500}}

请帮助我,我在错误的一步,你的帮助将不胜感激。提前谢谢

1 个答案:

答案 0 :(得分:0)

从错误消息中,您的postID似乎是空的。此外,您没有DELETE次请求,而是GET。确保您拥有publish_actions权限。

代码:

HttpDelete dislikePost = new HttpDelete(postURL);