Search code examples
apiinstagraminstagram-apiendpoint

Get historical data using Instagram API endpoints.


I am trying to fetch data using the Instagram API endpoints. Steps that I have followed 1. Register the client app. 2. Got the access token. 3. I am using this access token through out the url endpoints. Ex. to get the data for recent media I am using this url endpoint: https://api.instagram.com/v1/users/self/media/recent/?access_token=ACCESS-TOKEN

However as I am in Sandbox mode, as per the documentation I get only the recent 20 media. Whereas my account contains in total 291 media. Problems that I am facing:

  1. Not able to get next_url in the paginationpart.
  2. Usage of min_id and max_id in the url does not respond to any changes in the output or the data i.e fetched (Still get only 20 records/media)

Ex: https://api.instagram.com/v1/users/self/media/recent?access_token=XXXXXX&min_id=xxxxxx_xxxxx&max_id=xxxxxxx_xxxxxxx

Can anybody provide a solution as to how exactly I should get all of my historical data ?


Solution

  • You're in the sandbox mode so there's no way to achieve what you're trying to do before your app has been reviewed and approved (and gone live). From Instagram API documentation:

    After your app has been reviewed and approved, you are ready to make it available to the general public. To switch your client from sandbox to live mode, you can use the button on the top section of the configuration screen for your app. When you are live, any Instagram user will be able to authorize your app, but you will have access only to the permissions that you were granted during the review.