Search code examples
javainstagram-api

Using the Instagram API to pull media from an user that I do not own


I want to make a web application that shows post from a user that I do not own. I want to pull images only from the users' account. I have an API key and tried many times but I get errors. https://api.instagram.com/v1/users/NAME/media/recent?max_id=XXXXXXXXXXX

Does that user need to login? The users account for which I want to pull images from is not private but how would I do this with a private account.


Solution

  • The API needs a user-id not NAME, also you need access_token in the url param, like this:

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

    try 3 for {user-id} in the above API call and you will get a response, as long as you have permission for public_content for you app and your app is not in sandbox mode,

    (If you are in sandbox mode, then the user you are accessing should be added to your sandbox and accepted.)