[英]Create post with location using Facebook Graph API
如何使用JavaScript SDK在Facebook上發布位置(使用緯度和經度)? 找不到任何帶位置的帖子示例。
在帖子中發布位置是否需要Open Graph動作創建?
此外,是否可以共享頁面的URL,而是使用頁面上的Open Graph標簽來共享位置詳細信息以便在Facebook帖子中使用?
使用短信創建帖子的JavaScript代碼:
var body = 'Reading JS SDK documentation';
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
文檔中的一個例子說:
You can make a POST request to locations edge from the following paths:
/{page_id}/locations
When posting to this edge, a Location will be created.
這是否意味着無法使用Graph API為用戶的Feed創建位置信息?
參考:
編輯:
能找到一個例子來創建一個附帶的回答位置后在這里 :
FB.api('/me/feed', 'post', {
name: 'SomeName',
message: 'SomeMessage',
place: '106039436102339' // ID for Tallinn, Estonia
}, function (response) {});
雖然下一個問題是,如何使用緯度和經度查找位置ID?
您可以通過https://graph.facebook.com/search?q=karachi&type=page&access_token=YOURTOKEN
找到位置ID。這將為您提供與卡拉奇相匹配的地方列表。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.