Instagram API: Follow Release

I am trying to use the Instagram API to keep track of an array of users (through their identifiers). I use the last endpoint described here: http://instagram.com/developer/endpoints/relationships/ . After sending the request, I get 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 tried a few permutations by putting the access_token in the data array and in the url, also the same as action = "follow". It seems that the endpoint does not receive the action parameter and simply returns the status of the current relationship.

+4
source share
1 answer

I had the same error. If you look at the network call from the developer toolbar, I bet you are making a GET request for user relationships, and the server returns this data.

You need to specify one of // action = {follow, cancel, block, unblock, approve, reject}.

I read a lot of client side CORS questions for POST requests, especially for the POST relationship.

+1
source

Source: https://habr.com/ru/post/1487971/


All Articles