Instagram API not returning data - instagram

I am quite new to the Instagram API. I have been able to authorize myself and get an access token. I used the following URL to search for users, but to no avail:
https://api.instagram.com/v1/users/search?q=jack&access_token=3316552483.1677ed0.ab992a6bf15c4bbe99f093e59043547b&count=10
Keep in mind this specific URL will not work because that is not my real access token. However, when I do use my reall access token, I get this response:
{
"meta": {
"code": 200
},
"data": []
}
I have scanned the API documentation and I cannot find where my problem is. Keep in mind, I am a sandbox user, and that may have something to do with it.

Looks like you are in Sandbox mode, it will only show your and your sandbox user's posts in API response, here is documentation for sandbox:
The behavior of the API when you are in sandbox mode is the same as
when your app is live, but comes with the following restrictions:
Data is restricted to sandbox users and the 20 most recent media from each sandbox user
Reduced API rate limits
The first point is important and it means that the API behaves as if
the only users on Instagram were your sandbox users, and the only
media ever posted were the last 20 for each of these users.
In the API call, search your username then it will be shown in API response

Related

Instagram api returns HTTP status 200 but response contains empty data array

My curl request to get users id is not returning any data.
https://api.instagram.com/v1/users/search?q=xxxxx&access_token=xxxxxxxxxxxxx
Here is the result i am getting:
{"data": [], "meta": {"code": 200}}
Any thought where there might be any issue?
Thanks,
Mojgan
I think you are in Sandbox mode. In Sandbox mode you will only see your data and the users you approved to sandbox.
If you search your username in the API call q=, you will see just your user details in the data=[] response.
Once you go live and have been approved for public_content, you will see all the user results.
Read more about Sandbox mode here:
https://www.instagram.com/developer/sandbox/
Data is restricted to sandbox users and the 20 most recent media from
each sandbox user
Apps in sandbox are restricted to 10 users
Data is restricted to the 10 users and the 20 most recent media from
each of those users
Instagram changed their API settings and ruined so many app across the web this morning. They are switching to FB https://developers.facebook.com/products/instagram/
To use the new Instagram API features, users will need to have a business profile and will be required to use a Facebook Login when granting access to third party tools.

Instagram API get followers list

I am using Instagram public API using the following endpoint but am only getting details of one follower in the response. Why is the API returning only one follower (that is part of sandbox users, none else)?
https://api.instagram.com/v1/users/self/followed-by?access_token=ACCESS_TOKEN where ACCESS_TOKEN is one I got from Instagram.
If your application is in sandbox mode, you can't access data of users other than listed in sandbox users.
As mentioned in API Behavior section of this documentation
Data is restricted to sandbox users and the 20 most recent media from each sandbox user.

Instagram API says user does not exist

The user jwinery clearly exists: https://www.instagram.com/jwinery/
Querying the search API (/v1/users/search?q=jwinery&access_token=) gives you this user id: 321285908
Querying the users API (/v1/users/321285908/?access_token=) gives you this response:
{"meta": {"error_type": "APINotFoundError", "code": 400, "error_message": "this user does not exist"}}
My user is not in sandbox mode and has been approved, the access token is valid, and this has worked with thousands of users already. I know Instagram doesn't have the best error reporting so could this be another issue with jwinery or is Instagram just borking this? jwinery is obviously not private, but I don't use Instagram so I don't know all the other things that could be going on.
very interesting
https://www.instagram.com/jwinery/ said does not exist.
Search API is showing the id as valid, but user API for id does not return user info. this user does not exist
I checked the user #jwinery on instagram app, it opened, but asked me to confirm I'm over 21, and then it showed images on Instagram app.
Then I checked on https://www.instagram.com/jwinery/, it worked.
I used User API, it responded with data.
So I guess, API does not give you correct response until you have opened that user in App and then confirm over 21.
Also the access_token you use for API call should of the same user that was used to confirm over 21 on instagram app, then it will start working on API
So I guess this is a new category of profile type, that is not supported correctly in API yet.

I want to show the last photos of my instagram on my website, can I do that with their API?

I'm using a javascript code (instafeed.js) to connect to the Instagram API and get the last photos of my Instagram account. The problem is that the thing works for a few days and then the token I got from instagram "expires" or something and it stops working. It throws me Uncaught Error: Error from Instagram: The access_token provided is invalid.
I believe (I might be wrong) it's because I never sent my "app" for review and they are giving me a "sandbox mode" token. Or should I be able to use their API for this simple thing without approval?
Should I send my website for review or is this not an intended use of their API? And if it's not, what should I do?
You should be able to use API in sandbox mode to access your latest 20 posts. You dont need to get reviewed.
Not sure about access_token expiring, in live mode it never expires, so I expect sandbox to be same

Instagram /users/{user-id}/media/recent APINotAllowedError

I'm trying to fetch posts of the users whom I follow in instagram. I've created the app, I receive valid access token, app is running in the sandbox mode. I've added a user in the sandbox, whom I follow, as in sandbox only sandbox user data is available for viewing. What I'm trying is to fetch user's follow list, that is successfully done through users/self/follows?access_token=ACCESS_TOKEN request, which succeeds and I already have the user id. Then I'm trying to call /users/{user-id}/media/recent for getting that user's recent media. I believe this should work, as I'm following that user and that user has approved my follow request. However the request fails telling following
{
"meta": {
"error_type": "APINotAllowedError",
"code": 400,
"error_message": "you cannot view this resource"
}
}
Some details how I've configured the instagram app.
The scope that I use is basic+public_content+follower_list.
I don't use implicit authentication, and have custom backend to handle authentication with client_secret.
Also, I know an app Followers+ which can read the media of each user you follow. So this should be something that is possible to do, and I don't know why I can't do that.
Any ideas?
Thanks
Looks the error you get if user is private, if the user is private, then you cannot access the user via API even if you are approved to follow by that user. This was a new change in API post June 1, 2016.
The only way to access private users is to use Instagram app or instagram.com

Resources