Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New Instagram API - How do you request tagged media?

This question is going to seem like a duplicate of all the previous ones around this issue, specifically this question PHP Instagram API - How to get MIN_TAG_ID and MAX_TAG_ID. But with the new API changes the previous answers no longer work.

Goal

I want to request media for a specific tag.

The Documentation

Instagrams documentation on getting tagged media specifies you need to have the public_content scope and that there are 4 available parameters; ACCESS_TOKEN, COUNT, MIN_TAG_ID, and MAX_TAG_ID.

My API Request

https://api.instagram.com/v1/tags/cats/media/recent?access_token=TOKEN&max_tag_id=123

Which gives me this API response.

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

The Issue

As you can see from the request I am not specifying either of the deprecated parameters; next_max_id or min_id.

I have tried these alternate requests with the same result:

  • https://api.instagram.com/v1/tags/cats/media/recent?access_token=TOKEN
  • https://api.instagram.com/v1/tags/cats/media/recent?access_token=TOKEN&max_tag_id=123
  • https://api.instagram.com/v1/tags/cats/media/recent?access_token=TOKEN&min_tag_id=123
  • https://api.instagram.com/v1/tags/cats/media/recent?access_token=TOKEN&min_id=123
  • https://api.instagram.com/v1/tags/cats/media/recent?access_token=TOKEN&max_id=123
  • https://api.instagram.com/v1/tags/cats/media/recent?access_token=TOKEN&next_max_id=123
  • https://api.instagram.com/v1/tags/cats/media/recent?access_token=TOKEN&next_min_id=123

Things I Have Looked At

My app approval: I have a sandboxed app which I'm using the same account for authenticating with. If I understand the documentation properly I should have access to all the APIs with my setup.

Available media: I'm using the "cat" tag to test, which should have plenty of media to request.

My access_token: I don't think this is an issue because I'm using the same access token to make authenticated public_content scope requests to the /users/user-id/media/recent endpoint successfully.

The official python-instagram repo: I couldn't quite parse how they were making the requests but it's last commit was in July so I'm not even sure it works with the latest API.

Related Quesions

  • Instagram new API, get items by tag
  • Instagram API: I want to get recent images based on tag, but I only recieve my own
like image 296
shrunyan Avatar asked Dec 09 '15 22:12

shrunyan


1 Answers

Reread the sandbox documentation and caught this sentence.

But instead of returning media from any public Instagram user, it will return only media that belongs to your sandbox users, restricted to the last 20 for each user.

I needed to use a tag that I had posted before. Leaving the question for anyone else dealing with the issue.

like image 65
shrunyan Avatar answered Sep 25 '22 14:09

shrunyan