gpt4 book ai didi

facebook - 使用 Facebook Graphs API 发布照片并标记好友

转载 作者:行者123 更新时间:2023-12-02 22:40:27 25 4
gpt4 key购买 nike

我将这段代码发布到用户的墙上:

FB.api('/me/photos', 'post', {
message:'photo description',
url:imgURL
}, function(response){
console.log(response);
if (!response || response.error) {
console.log(response);
}else{
FB.api(response.id+'/tags/me', {
to: $("#recipientID").val()
}, function(response){
console.log(response)
});
}
});

第一部分工作得很好我只是想不出如何将 friend 标记到其中,我的标记调用返回一个空数组。 Facebook 文档真的很难理解,它并没有真正给出任何示例来说明如何做到这一点,所以请不要只给我一个指向他们文档的链接,因为我已经阅读了他们拥有的任何相关内容,但我仍然可以”不要这样做。

也尝试过这个但没有成功:

FB.api('/me', function(response){
var userId = response.id;
FB.api('/'+response.id+'/tags/'+userId, {
to: $("#recipientID").val()
}, function(response){
console.log(response)
});
});

最佳答案

我终于设法破解了它,它与我使用的调用不同:

FB.api('/me/photos', 'post', {
message:'Checking tags',
url:imgURL
}, function(response){
if (!response || response.error) {
console.log(response);
}else{
//tags friend
var postId = response.id;
FB.api(postId+'/tags?to='+friendID, 'post', function(response){
if (!response || response.error) {
console.log(response);
}
});
}
});

关于facebook - 使用 Facebook Graphs API 发布照片并标记好友,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10843749/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com