如何隐藏从时间轴使用Graph API创建的事件

时间:2013-01-10 01:19:21

标签: asp.net facebook-graph-api

我正在使用图形api为页面创建许多事件,一次最多可以创建几百个事件。但是,每个事件都会在时间轴上创建一个我不想发生的帖子。

创建活动是否有办法让它不在时间轴上显示?如果没有,我怎样才能在时间轴上获得帖子的ID?如果有帮助的话,我正在记录每个事件的ID。

提前感谢您提供的任何帮助!

吉姆

1 个答案:

答案 0 :(得分:0)

我已尝试设置' no_feed_story'参数为1但它似乎没有做到这一点(至少在沙盒模式下)。

我最终做的是进行另一个查询以获取页面提要以查找提及事件创建的帖子的ID,然后将其删除(需要publish_stream权限)

以下是php中的一个示例(抱歉,我不能使用asp.net):

// .. curl was configured and the event created just before this.
$newEventId = $result['id'];

curl_setopt($ch, CURLOPT_URL, "https://graph.facebook.com/$page/feed?access_token=$accessToken");

curl_setopt($ch, CURLOPT_POST, false);

$received_content = curl_exec($ch);

$result = json_decode($received_content, true);

foreach ($result['data'] as $feed)
{
  if ($feed['link'] == "https://www.facebook.com/events/$newEventId/")
  {
    $postId = $feed['id'];
    break;
  }
}

if (isset($postId))
{
  curl_setopt($ch, CURLOPT_URL, "https://graph.facebook.com/$postId?access_token=$accessToken");

  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');

  $received_content = curl_exec($ch);

  $result = json_decode($received_content, true);

  var_dump($result);
}