Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Instagram API -Get the userId

We had integrated instagram api (with {userId}/media/recent) to get media feeds based on userId. It was working fine until June 1 2016 . Now on how do I get userId for new instagram pages which we need to include as with the new release of instagram it seems difficult. This is the error messsage we get from a site from where we used to get instagram userId. "This service is no longer available as of 01. June, due to changes in Instagram's API rules" from http://www.otzberg.net/iguserid/

Regards Raghav

like image 756
Raghav Thakur Avatar asked Jun 02 '16 13:06

Raghav Thakur


People also ask

What information can I get from Instagram API?

The API can be used to get and publish their media, manage and reply to comments on their media, identify media where they have been @mentioned by other Instagram users, find hashtagged media, and get basic metadata and metrics about other Instagram Businesses and Creators.

Can you login with Instagram API?

Authentication — Instagram Basic Display is not an authentication solution. Data returned by the API cannot be used to authenticate your app users or log them into your app. If you need an authentication solution we recommend using Facebook Login instead.


1 Answers

Definitely not the most elegant way, but without involving a running browser or an approved application, is to use the (undocumented?) search API:

https://www.instagram.com/web/search/topsearch/?context=user&count=0&query={username}

This returns matching users (as count is set to 0 it should not return more than one user).

After validating the results (checking if user includes one item), you can get the userid e.g. in javascript with

response.users[0].user.pk

where response is an object with the parsed response.

like image 187
Simon Bruder Avatar answered Sep 27 '22 21:09

Simon Bruder