[英]How to get instagram username from new facebook graph API
看看新的 Instagram Graph API - 一旦用户登录,就没有直接的方法来检索username
。 尽管官方文档中说,调用像
"https://graph.facebook.com/v3.2/17841405822304914?fields=biography%2Cid%2Cusername%2Cwebsite&access_token=EAACwX..."
应该返回以下内容:
{
"biography": "Dino data crunching app",
"id": "17841405822304914",
"username": "metricsaurus",
"website": "http://www.metricsaurus.com/"
}
目前这会返回一个错误,貌似没有这样的选项来获得一个Instagram的商业用户的唯一用户名。
如果您正在谈论获取链接到您的 Facebook 页面的 Instagram 商业帐户的用户名,您可以使用以下 curl
curl -i -X GET "https://graph.facebook.com/v3.2/me/accounts?fields=instagram_business_account%7Busername%2Cname%2Cig_id%7D&access_token=<access_token>"
请在上面的 curl 中将 access_token 替换为您的用户访问令牌。
您将获得上述卷曲的示例响应如下:
{
"data": [
{
"instagram_business_account": {
"username": "<instagram user name>",
"name": "<instagram display name>",
"id": "<corresponding facebook graph id for instagram profile>",
"ig_id": <instagram profile id>
},
"id": "<facebook page id>"
}
],
"paging": {
"cursors": {
"before": "MTc2Njg1MTU2MTI1ODA1",
"after": "OTg3MzU1NzExNDUwMDg3"
}
}
}
我只能通过使用旧的 api来解决这个问题。
根据他们的文档,虽然旧的 API 即将被弃用,但截至目前,它适用于小型企业或个人应用程序。 新的Instagram Graph API是“用于访问大中型 Instagram 商业帐户中的数据的 API”
看起来FB不知道它的方式。
如果它对某人有帮助..现在最好像这样 GrapAPI v10.0
FB.api('/' + pageID + '?fields=instagram_business_account{id,name,username}',
function (response) {
// TODO: whatever you want
},
{ access_token: accessToken }
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.