FrancoisD
FrancoisD

Reputation: 59

Instafeed : invalid media id

I try to use instafeed.js to display the 10 last instagram post from my account, on my magento website.

Here is my script :

<script type="text/javascript">
        var feed = new Instafeed({
            clientId: 'myclientid',
            accessToken: 'myaccesstoken',
            template: '<a href="{{link}}"><img src="{{image}}" /></a>',
            sortBy: 'most-recent',
            limit: '10',
            resolution: 'thumbnail'
        });
        feed.run();
</script>

It returns me an error : Error from Instagram: invalid media id

Of course my instagram application is in sandbox mode, and from what I read on the instragram website, it will stay at this state for this kind of use. And I've unchecked the OAuth security.

I don't understand what I means by 'invalid media id'. Can you help me ?

Thanks

Upvotes: 0

Views: 919

Answers (1)

Steven Schobert
Steven Schobert

Reputation: 4269

If you're trying to post images from your own account, then you need to set the get and userId options accordingly:

var feed = new Instafeed({
    get: 'user',      // <-- new
    userId: 'xxxx',   // <-- new
    clientId: 'myclientid',
    accessToken: 'myaccesstoken',
    template: '<a href="{{link}}"><img src="{{image}}" /></a>',
    sortBy: 'most-recent',
    limit: '10',
    resolution: 'thumbnail'
});
feed.run();

Without those options set, Instafeed.js will try and pull the "popular" media from Instagram, which has been removed from their API, and is no longer valid.

Upvotes: 1

Related Questions