1

I am trying to search and get datas (Profile picture and username )from the exact or specific username with Instagram API. The problem is if I search for example starwars it won't show me the official page it shows me this username : starwars_viii !!! Here is my code :

https://api.instagram.com/v1/users/search?q=[USERNAME]&client_id=[CLIENT ID]&count=1
  • I checked and someone said if count=1 it gives you the exact search but it did not work .
  • I tried "usersname" with quotation it did not
  • work ! I removed count and same result !

I have to say I am getting datas without authentication.

iOS.Lover
  • 5,923
  • 21
  • 90
  • 162

2 Answers2

1

Are you sure it's enough to provide the client id only? According to their docs, you should provide an access_token:

https://api.instagram.com/v1/users/search?q=jack&access_token=ACCESS-TOKEN

Response:

{
    "data": [{
        "username": "jack",
        "first_name": "Jack",
        "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_66_75sq.jpg",
        "id": "66",
        "last_name": "Dorsey"
    },
    {
        "username": "sammyjack",
        "first_name": "Sammy",
        "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_29648_75sq_1294520029.jpg",
        "id": "29648",
        "last_name": "Jack"
    },
    {
        "username": "jacktiddy",
        "first_name": "Jack",
        "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_13096_75sq_1286441317.jpg",
        "id": "13096",
        "last_name": "Tiddy"
    }]
}

And as you can see in the response, the first result is the exact username "jack".

phi
  • 10,634
  • 6
  • 53
  • 88
0

I fix this issue by count = 10 and then filter it with the exact username

iOS.Lover
  • 5,923
  • 21
  • 90
  • 162