【问题标题】:Instagram API: Follow IssueInstagram API:关注问题
【发布时间】: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


【解决方案1】:

我有同样的错误。如果您查看开发人员工具栏中的网络调用,我敢打赌您正在为用户关系发出 GET 请求,并且服务器正在返回该数据。

您需要提供 //action={follow,unfollow,block,unblock,approve,deny} 之一。

我正在阅读很多关于 POST 请求的客户端 CORS 问题,尤其是关系 POST。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-08-13
    • 1970-01-01
    • 1970-01-01
    • 2018-07-17
    • 2015-09-27
    • 1970-01-01
    • 2019-03-07
    • 1970-01-01
    相关资源
    最近更新 更多