L
L
Leonid Fedotov2014-01-09 20:43:59
JavaScript
Leonid Fedotov, 2014-01-09 20:43:59

Why doesn't the Instagram API like a photo?

While writing a JS application for Windows 8 (Instagram client) I encountered a strange problem in the interaction of my application with the Instagram API. Everything loads fine except for one weird problem: the Instagram API doesn't like the photo.

Here is the JS function code:

var LikeImage = function(id){
     $.ajax({
    	type: "POST",
        dataType: "jsonp",
        data: ({access_token:token}),
        cache: false,
        url: "https://api.instagram.com/v1/media/"+id+"/likes",
    success: function(data){
      return true;
        },
    fail: function(){
      return false;
    }
    });
};


When the function is called, the application uses the POST method to the Instagram API via https, waiting for Json. If you look at the Instagram API response log, you can see:
jQuery110204075711192563176_1389288070824({"meta":{"code":200},"data":[{...}]})

After reading the Instagram API documentation, you can tell that this response says us that the like request was successfully accepted (status 200).
After that, I had to go to the Instagram application itself on the iPhone, and if we look for the presence of a like on a just liked photo, we will not see it there.

Question - what's the problem? Where is the mistake? In the Instagram API documentation, it seems that status 200 means that the like is accepted, and in theory it should be there, but it shouldn't be.
PS I've been sitting for hours on a trivial task and I can't figure out where I'm stupid...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmeoff, 2014-01-10
@iLeonidze

Magic magic! If you do it not through JS, but through PHP - everything works!
Why doesn't he want to use JavaScript?

Apparently you are not authorizing the user (the user, not the application), or you are handling the "access_token" incorrectly. therefore it doesn't work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question