4
votes

I am trying to use the Instagram API to follow an array of users (via their id's). I am using the last endpoint documented here: http://instagram.com/developer/endpoints/relationships/. After sending the request, I receive some data back (code: 200, incoming_status:"none", outgoing_status:"none").

Here is the code snippet (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
         }
      });
   }
}

I have tried a few permutations of putting the access_token in the data array and in the url, also the same with the action="follow". It seems like the endpoint is not receiving the action parameter and is simply returning the status of the current relationship.

1
Did you supplied scope for Relations when registering your app? incoming_status:"none", outgoing_status:"none" means your request to instagram sending but due to invalid permissions.it is not processing. - user2511671
You should use post method not get. You should add action as parameter with follow for value. You can not access relation end point without requesting access to it, apparently you should fill out a form. Please let me know i f you fill out the form because i 'm having the same issue - hadi

1 Answers

1
votes

I had the same error. If you take a look at the Network call from the Developers Toolbar, I bet you're making a GET request for the user relationship, and the server is returning that data.

You need to supply one of //action={follow,unfollow,block,unblock,approve,deny}.

I am reading a lot of client side CORS issues for POST requests, especially for the relationship POST.