Mike Simz
Mike Simz

Reputation: 4026

Instagram API - Username instead of User-ID

I am trying to get all recent posts of a specific user using Instagram API. I know that I can make a request like this:

https://api.instagram.com/v1/users/{user-id}/media/recent/?access_token=ACCESS-TOKEN

That being said, I do not know the user-id of a specific user. I would like to simply use the user's "username" instead of the user-id which I do not have. Can someone please help me to achieve this. Any help would be greatly appreciated!

Upvotes: 1

Views: 290

Answers (1)

krisrak
krisrak

Reputation: 12952

There is no direct way to get user photos by username

First make a user search api request:

https://api.instagram.com/v1/users/search?q=

find the match for username in response and get the user-id, then make the recent media api request:

https://api.instagram.com/v1/users/{user-id}/media/recent/?access_token=ACCESS-TOKEN

Upvotes: 2

Related Questions