【发布时间】:2013-06-24 22:46:57
【问题描述】:
我正在尝试使用 Instagram API 来关注一系列用户(通过他们的 ID)。我正在使用此处记录的最后一个端点:http://instagram.com/developer/endpoints/relationships/。发送请求后,我收到了一些数据(代码:200,incoming_status:“none”,going_status:“none”)。
这里是代码 sn-p (javascript with jQuery):
var access_parameters = {action:"follow"};
for (key in users) {
if (users.hasOwnProperty(key)) {
var username = key;
var instagramUrl = "https://api.instagram.com/v1/users/"+users[key][0]+"/relationship?access_token=[ACCESS_TOKEN]"; //where users[key][0] is the id of the user intended to follow and [ACCESS_TOKEN] is my access token
$.ajax({
type:"POST",
async: false,
dataType: 'jsonp',
url: instagramUrl,
contentType: 'text/plain; charset=UTF-8',
data: access_parameters
}).done(function ( data ) {
if( console && console.log ) {
console.log(data); //this is where the above data comes through
}
});
}
}
我尝试了几种将 access_token 放入数据数组和 url 的排列方式,action="follow" 也是如此。看起来端点没有接收到 action 参数,只是返回了当前关系的状态。
【问题讨论】:
-
您在注册应用程序时是否提供了关系范围?传入状态:“无”,传出状态:“无”表示您的instagram发送请求,但由于权限无效。它没有处理。
-
你应该使用post方法而不是get。您应该将操作添加为参数,并跟随值。如果不请求访问关系端点,您就无法访问它,显然您应该填写表格。如果您填写表格,请告诉我,因为我遇到了同样的问题
标签: api jquery relationship instagram endpoint