如何通过 graph api 将自定义日期添加到 facebook 时间线
我想在新的 Facebook 时间线中插入一个具有特定日期的条目(例如,2008 年 2 月 10 日),但不是手动插入。我希望能够使用 graph api 或新的 open-graph-beta 来完成此操作。是否有特定的 api 调用可以做到这一点,或者是否有其他方法。
更新:
我发现在 api 调用中您需要指定 start_time 和 end_time 参数,如下面的代码片段所示:
FB.api('me/APP_NAMESPACE:ACTION?\
start_time=904920127&\
expires_in=905006527&\
OBJECT_TYPE=URL&\
access_token=YOUR_ACCESS_TOKEN', 'post', function (response) {
if (!response || response.error) {
console.log(response);
} else {
alert('Post was successful! Action ID: ' + response.id);
console.log(response)
}
});
然而,这样做的问题在于它只是将特定年份添加到您的时间线中,并且并没有真正向该特定时间线添加条目,即,当我单击刚刚在时间线应用程序中创建的特定年份时,除了在时间线中看到新的一年之外,不会显示任何内容这个案例是1998年。
I want to insert an entry to the new facebook timeline with a specific date (e.g., February 10, 2008), but not manually. I want to be able to do this using either the graph api or the new open-graph-beta. Is there a specific api call that can do this, or is there some other way.
Update:
I have figured out that in the api call you need to specify the start_time and end_time parameters as seen in the snippet below:
FB.api('me/APP_NAMESPACE:ACTION?\
start_time=904920127&\
expires_in=905006527&\
OBJECT_TYPE=URL&\
access_token=YOUR_ACCESS_TOKEN', 'post', function (response) {
if (!response || response.error) {
console.log(response);
} else {
alert('Post was successful! Action ID: ' + response.id);
console.log(response)
}
});
However the problem with this is that it just adds a specific year to your timeline and doesn't really add an entry to that particular timeline, i.e., when I click on the particular year I just created in my timeline app nothing shows up besides seeing the new year in my time line, in this case it's 1998.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您通过 Graph API 发布操作时,您可以设置“start_time”和“end_time”参数。
这会告诉 Facebook 操作何时发生 - 并且对于回载很久以前的历史操作或延迟操作(例如发布离线收听活动)非常有用。
Facebook 代表了事件发生时间段内的时间轴上的操作。将 start_time 设置为过去将使该活动在其时间轴上显示为过去。
请注意,发布“虚假”过去的操作是违反政策的 - 您只能发布用户过去实际执行的操作。
When you post an action via the Graph API, you can set 'start_time' and 'end_time' parameters.
This tells Facebook when the action occurred - and is useful for both backloading historical actions from a long time ago, or delayed actions like publishing offline listening activity.
Facebook represents actions on the timeline in the time period in which they occurred. Setting start_time in the past will make the activity appear in the past on their timeline.
Note that its against policy to publish 'fake' past actions - you must only publish actions that the user actually did in the past.
我认为这可能是不允许的,这是您过去的 start_time 得到的结果:
{“error”:{“type”:“Exception”,“message”:“您尝试发布的操作无效,因为'您提供的“1325770789”的“start_time”已经超过“86400”秒了。”}}
I think it may not be allowed, here's what you get for a start_time in the past :
{"error":{"type":"Exception","message":"The action you are trying to publish is invalid because the 'start_time' you provided of '1325770789' is more than '86400' seconds in the past."}}