Search code examples
httpwebrequestinstagraminstagram-api

Is possible to use Instagram tags/xxx/media/recent endpoint in sandbox?


I'm trying to use this endpoint on Instagram API in sandbox:

https://api.instagram.com/v1/tags/<NAME>/media/recent?access_token=<TOKEN>

But it returns:

{"pagination": {"deprecation_warning": "next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead"}, "meta": {"code": 200}, "data": []}

So I tried:

https://api.instagram.com/v1/tags/brasilbest/media/recent?access_token=3942609881.87c85c5.9823c28375544c5395f83db9c01a12f8&min_tag_id=0&max_tag_id=10

And it returns:

{"meta": {"error_type": "APIInvalidParametersError", "code": 400, "error_message": "max_id must not be a media id."}}

I tried to use only max_tag_id and only min_tag_id, I also tried different values for max_tag_id and min_tag_id.

My question is how I use max_tag_id and min_tag_id in that request and if it's possible to get recent media while my app is in sandbox ?

For the record, when i use

https://api.instagram.com/v1/tags/search?q=google&access_token=<TOKEN>

Or:

https://api.instagram.com/v1/tags/google?access_token=3942609881.87c85c5.9823c28375544c5395f83db9c01a12f8

It works. But v1/tags/google/media/recent doesn't .


Solution

  • You can only get 20 posts in Sandbox mode and will only show yours and sandbox users' posts in API response.

    If you add a photo with the hashtag, then API response will have just your photo in API response, if not it will be empty.

    Once you go live from sandbox, u will get all post.

    max_tag_id and min_tag_id will not work in Sandbox mode since it is limited to latest 20 posts.

    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