【问题标题】:Get Facebook Pages Events using graph Api使用 graph Api 获取 Facebook 页面事件
【发布时间】:2023-04-06 17:44:01
【问题描述】:

我正在尝试使用 facebook graph api 从页面配置文件中获取 facebook 事件。 我使用的方法如下

HttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet("https://graph.facebook.com/oauth/access_token?client_id="+APP_ID+"&client_secret="+APP_SECRET+"&grant_type=client_credentials");
ResponseHandler<String> responseHandler = new BasicResponseHandler();
String access_token = client.execute(get, responseHandler);
String uri = "https://graph.facebook.com/PageName/events?"+access_token.replace("|","%7C");
get = new HttpGet(uri);
String responseBody = client.execute(get, responseHandler);

其中 APP_ID、APP_SECRET 和 PageName 我将替换为我的详细信息。 它的工作没有问题,我也从 Facebook 获得响应作为 json 数组,其中包括事件的名称、开始时间、结束时间、时区、位置、id,但没有 事件描述 .

如何解决这个问题?

【问题讨论】:

    标签: android facebook events facebook-graph-api facebook-android-sdk


    【解决方案1】:

    默认情况下,您不会获得事件描述,但您可以使用fields 添加相同的内容以及您需要的其他信息并检索更详细的列表。所以你需要把你的uri改成

    String uri = "https://graph.facebook.com/PageName/events?fields=name,start_time,timezone,location,description"+access_token.replace("|","%7C");
    

    检索所需信息。

    【讨论】:

    【解决方案2】:

    使用您在响应中获得的Event ID,并使用它从以下位置获取该事件的每个细节:

    "https://graph.facebook.com/EVENT_ID"
    

    【讨论】:

      猜你喜欢
      • 2012-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-23
      • 2012-04-26
      相关资源
      最近更新 更多