如何解决我需要如何以及通过该帖子的ID从帖子中获取用户名的请求? Instagram API
我有两个access_tokens:
- 从Instagram Graph API:
var fs_access_token
(使用Facebook登录后获得); - 来自Instagram基本显示:
var inst_access_token
; 所以 我有收集的帖子ID,这些ID是通过ig_hashtag_search
获得的:
var posts_ids; //!= null;
我在Instagram商业帐户上也有3条帖子。 然后,我尝试获取我的收藏夹中所有带有一个端点的所有帖子的用户名:
for (var u = 0; u < posts_ids.length; u++) {
fetch("https://graph.instagram.com/" + posts_ids[u] + "?fields=username&access_token=" + inst_access_token).then(function (response) {
response.text().then(function (text) {
alert(text); //using Instagram Basic Display
});
});
}
但是随后我从此请求中得到了错误:
{
"error": {
"message": "Unsupported get request. Object with ID '17884048231750634' does not exist,cannot be loaded due to missing permissions,or does not support this operation","type": "IGApiException","code": 100,"error_subcode": 33,"fbtrace_id": "AKiycowo9LbwZbKzxOL-EQ9"
}
}
有趣的事实:如果我插入自己在Instagram商业帐户中拥有的帖子的ID而不是posts_ids [u],那么它将起作用! 所以,这到底是怎么回事?这意味着我只能从我在Instagram帐户上发布的帖子中获取“用户名数据”,不是吗?还是什么? 我还尝试使用其他endpoind来获取用户名,当然我使用了其他access_token,这是我登录Facebook后获得的(上面我使用的access_token是access_token,这是我登录Instagram后获得的; Instagram Graph API-登录Facebook和Instagram基本显示-登录Instagram):
for (var u = 0; u < posts_ids.length; u++) {
fetch("https://graph.facebook.com/v8.0/" + posts_ids[u] + "?fields=username&access_token=" + fs_access_token).then(function (response) {
response.text().then(function (text) {
alert(text);
});
});
}
但是我再次从请求中得到了错误:
{
"error": {
"message": "Unsupported get request. Object with ID '17884048231750634' does not exist,or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api","type": "GraphMethodException","fbtrace_id": "AhN5o9eopccP4NrQsu8QuaN"
}
}
这又是一个有趣的事实:如果我插入我在Instagram商业帐户中拥有的帖子的ID,而不是posts_ids [u],那么它将起作用! 我也尝试这样做:
for (var u = 0; u < posts_ids.length; u++) {
fetch("https://graph.facebook.com/v8.0/" + posts_ids[u] + "?fields=username&access_token=" + inst_access_token).then(function (response) {
response.text().then(function (text) {
alert(text);
});
});
}
和
for (var u = 0; u < posts_ids.length; u++) {
fetch("https://graph.instagram.com/" + posts_ids[u] + "?fields=username&access_token=" + fs_access_token).then(function (response) {
response.text().then(function (text) {
alert(text);
});
});
}
但随后出现此错误:
{
"error": {
"message": "Invalid OAuth access token.","type": "OAuthException","code": 190,"fbtrace_id": "ARVMttFmcIAfwBTPdYcMEfQ"
}
}
这很可能是因为我试图将来自Instagram的访问令牌与用于Facebook的技术相结合,并将来自Facebook的访问令牌与用于Instagram的技术相结合。 那么,您能否不能帮助我在Instagram Basic或Instagram Graph中找到终结点,该终结点允许从其他用户的帖子中获取用户名(特别是通过Hashtag Search / recent_media获得的ID)?还是您不能帮助我理解如何正确使用它?因为我是一个初学者,可能不知道一些细节。请帮我通过帖子ID获取帖子的用户名。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。