A
A
Anton Seredny2016-01-15 23:43:28
API
Anton Seredny, 2016-01-15 23:43:28

Why is the instagram API not working correctly?

I'm trying to display a photo from an instagram using a certain hashtag. There is a page where users need to show a feed of the latest photos for this tag. At the same time, it is necessary that the user just logs in and sees the photo, and does not log in to the application to see the content ... I.e. so that the application itself receives a token.
I am using code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Тест Instagram API</title>
</head>
<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>
<body>

    <script>
    var clientid = 'ТУТ ПРАВИЛЬНЫЙ КОД',
    token = 'ТУТ ПРАВИЛЬНЫЙ ТОКЕН',
    metka='kiev', // ну это тег, понятное дело
    kolichestvo = 4;
 
$.ajax({
    url: 'https://api.instagram.com/v1/tags/' + metka + '/media/recent',
    dataType: 'jsonp',
    type: 'GET',
    data: {client_id: clientid, count: kolichestvo, access_token: token },
    success: function(result){
        console.log(result);
        for(x in result.data){
            $('ul').append('<li><img src="'+result.data[x].images.standard_resolution.url+'"></li>');  
        }
    },
    error: function(result){
        console.log(result);
        console.log('Ошибка');

    }
});
    </script>

<ul></ul>

</body>
</html>

But the problem at this stage is even different . With a manually obtained token, when requested, I get this thing:
{"pagination":{"deprecation_warning":"next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead"},"meta":{"code":200},"data":[]}

I do everything according to the instagram documentation, other endpoints work correctly, but this one does not.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Seredny, 2016-01-16
@smidl

Now everything is clear.
These are all new Instagram features. The fact is that from November 17, 2015, all new applications work in sandbox mode. This means that you can only get sandbox user pictures by hashtag. in this case, I was the owner of the token, and I didn’t have any photos with the hashtag 'kiev'.
That's why there was an empty response. I added a photo with the right hashtag and everything worked as it should.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question