如何使用facebook API发布到我自己的页面
不久前,我有能力从我的网站发布到我的页面上,从那时起,似乎对API做了一些更改。现在,当我使用下面的代码片段时,我收到了错误消息如何使用facebook API发布到我自己的页面,facebook,facebook-graph-api,Facebook,Facebook Graph Api,不久前,我有能力从我的网站发布到我的页面上,从那时起,似乎对API做了一些更改。现在,当我使用下面的代码片段时,我收到了错误消息 {"message":"(#100) Only owners of the URL have the ability to specify the picture, name, thumbnail or description params.","type":"OAuthException","code":100,"fbtrace_id":"AsGjV6ebkihnC
{"message":"(#100) Only owners of the URL have the ability to specify the picture, name, thumbnail or description params.","type":"OAuthException","code":100,"fbtrace_id":"AsGjV6ebkihnC60tRtHM4f3"}
代码
是的,正如错误消息所显示的,这在一段时间前已经改变了。见相应章节 自定义链接页面张贴图像 有关详细信息,请参见文档:
当然,您也可以删除自定义描述参数。我只是按照您的建议删除了描述
function postToFeed(id, desc, name) {
var page_id = ************;
var app_id = ************;
FB.api('/' + page_id, {
fields : 'access_token'
}, function(resp) {
console.log(resp);
if (resp.access_token) {
FB.api('/' + page_id + '/feed', 'post', {
message : desc,
link : 'https://link',
name : name,
from : page_id,
description :'',
access_token : resp.access_token
}, function(response) {
if (!response || response.error) {
alert(JSON.stringify(response.error));
} else {
alert('Post ID: ' + response.id);
}
});
}
});