Question Detail

Instagram API to fetch pictures with specific hashtags

6 years ago Views 1848 Visit Post Reply

I want to get all the pictures with a specific hashtag from Instagram using API in Android. How can I do that?
Is there any pre developed Example for this?


Thread Reply

Anonymous

- 6 years ago

https://api.instagram.com/v1/tags/SOMETAG/media/recent?client_id=CLIENT_ID

It is not possible yet to search for content using multiple tags, for now only single tags are supported.

Firstly, the Instagram API endpoint "tags" required OAuth authentication.

This is not quite true, you only need an API-Key. Just register an application and add it to your requests. Example:

https://api.instagram.com/v1/users/userIdYouWantToGetMediaFrom/media/recent?client_id=yourAPIKey

Also, note that the username is not the user-id. You can look up user-id's here.

A workaround for searching multiple keywords would be if you start one request for each tag and compare the results on your server. Of course, this could slow down your site depending on how much keywords you want to compare.

Hemant Sharma

- 6 years ago

Direct the user to our authorization URL.

CLIENTID, redirect URI and secrate Key will get after create client by click here.

https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=token&scope=likes+comments +public_content

  • If the user is not logged in, they will be asked to log in.
  • The user will be asked if they would like to grant your application access to her Instagram data.

Here are the scopes we currently support:

  • basic - to read a user’s profile info and media
  • public_content - to read any public profile info and media on a user’s behalf (applications no longer accepted)
  • follower_list - to read the list of followers and followed-by users (applications no longer accepted)
  • comments - to post and delete comments on a user’s behalf (applications no longer accepted)
  • relationships - to follow and unfollow accounts on a user’s behalf (applications no longer accepted)
  • likes - to like and unlike media on a user’s behalf (applications no longer accepted)

 

User Profile Info : Get information about the owner of the access_token.

https://api.instagram.com/v1/users/self/?access_token=YOUR_ACCESS_TOKEN

 

Get information about a tag object.

https://api.instagram.com/v1/tags/YOURTAG?access_token=YOUR_ACCESS_TOKEN

 

Get a list of recently tagged media.

https://api.instagram.com/v1/tags/YOURTAG/media/recent?access_token=YOUR_ACCESS_TOKEN

PARAMETERS
ACCESS_TOKEN A valid access token.
MAX_TAG_ID Return media after this max_tag_id.
MIN_TAG_ID Return media before this min_tag_id.
COUNT Count of tagged media to return.

Hemant Sharma

- 6 years ago

Direct the user to our authorization URL.

CLIENTID, redirect URI and secrate Key will get after create client by click here.

https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=token&scope=likes+comments +public_content

  • If the user is not logged in, they will be asked to log in.
  • The user will be asked if they would like to grant your application access to her Instagram data.

Here are the scopes we currently support:

  • basic - to read a user’s profile info and media
  • public_content - to read any public profile info and media on a user’s behalf (applications no longer accepted)
  • follower_list - to read the list of followers and followed-by users (applications no longer accepted)
  • comments - to post and delete comments on a user’s behalf (applications no longer accepted)
  • relationships - to follow and unfollow accounts on a user’s behalf (applications no longer accepted)
  • likes - to like and unlike media on a user’s behalf (applications no longer accepted)

 

User Profile Info : Get information about the owner of the access_token.

https://api.instagram.com/v1/users/self/?access_token=YOUR_ACCESS_TOKEN

 

Get information about a tag object.

https://api.instagram.com/v1/tags/YOURTAG?access_token=YOUR_ACCESS_TOKEN

 

Get a list of recently tagged media.

https://api.instagram.com/v1/tags/YOURTAG/media/recent?access_token=YOUR_ACCESS_TOKEN

PARAMETERS
ACCESS_TOKEN A valid access token.
MAX_TAG_ID Return media after this max_tag_id.
MIN_TAG_ID Return media before this min_tag_id.
COUNT Count of tagged media to return.