Facebook Graph API - 删除像 [英] Facebook Graph API - delete like

查看:78
本文介绍了Facebook Graph API - 删除像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在PHP开发Facebook应用程序,其中列出了用户的喜欢。我想添加一个旁边的链接,以便用户可以通过删除他们认为合适的地方来管理他们的喜好。

I'm developing an app for Facebook in PHP, part of which lists the user's "likes". I would like to add a link next to each like so that the user can manage their likes by deleting them where they see fit.

Facebook在他们的图表中提到这个API :

Facebook mentions this in their graph api docs:


您可以通过向/ POST_ID /喜欢发出DELETE请求来删除类似的东西(因为喜欢没有ID) / p>

You can delete a like by issuing a DELETE request to /POST_ID/likes (since likes don't have an ID).

但是每个人都必须有一个id - 你还会如何删除它?

But each like must have an id - how else would you delete it?

有没有人这样做?

推荐答案

是的,喜欢在Graph API中没有ID。您喜欢或不像一个项目通过POST或DELETEing到 {item_id} / likes ,其中 {item_id} 被替换为您喜欢/不开心的对象的ID。

Yes, likes don't have an ID in the Graph API. You like or unlike an item by POSTing or DELETEing to {item_id}/likes, where {item_id} is replaced by the ID of the object you're liking/unliking.

要了解当前用户喜欢什么(因此可以适当地删除它们),您可以使用喜欢用户对象的连接(文档)。所以,如果您要求 http://graph.facebook.com/me/likes ,您将获得用户所喜欢的页面/人物列表。 (注意:这不包括帖子或照片或类似的东西)

To find out what the current user has liked (so you can delete them appropriately), you can use the "likes" connection of the User object (docs). So, if you request http://graph.facebook.com/me/likes, you'll get a list of pages/people/whatever that a user has liked. (Note: this does not include posts or photos or things like that)

这将返回一个完整的数据的数组,如下所示:

This will return an array of data full of items like this:

{
     "name": "Very Hungry Caterpillar",
     "category": "Artist",
     "id": "29956247793",
     "created_time": "2009-03-27T15:48:29+0000"
}

其中的ID是 类似的ID。它是用户喜欢的对象的ID,因此为了不喜欢它,您必须将DELETE设置为 http://graph.facebook.com/29956247793/likes

这篇关于Facebook Graph API - 删除像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆