{"id":12731,"date":"2014-04-04T01:57:21","date_gmt":"2014-04-03T20:27:21","guid":{"rendered":"https:\/\/2thenew.xyz\/blog\/?p=12731"},"modified":"2014-04-04T01:57:21","modified_gmt":"2014-04-03T20:27:21","slug":"instagram-api-fetch-users-followers-and-media","status":"publish","type":"post","link":"https:\/\/2thenew.xyz\/blog\/instagram-api-fetch-users-followers-and-media\/","title":{"rendered":"Instagram API: Fetch user&#8217;s followers and media"},"content":{"rendered":"<p>In my <a title=\"Using Instagram API to login via Grails\" href=\"https:\/\/2thenew.xyz\/blog\/using-the-instagram-login-api-via-grails\/\" target=\"_blank\">previous blog<\/a> we learnt how to integrate Instagram login functionality in a Grails web app. Now we will see how to get Instagram user&#8217;s followers and media.<\/p>\n<p>Once a user is logged in via the Instagram login API, we get a JSON response containing the logged in user&#8217;s profile information in JSON Format. A sample JSON is as follows:<\/p>\n<p>[code]&lt;br \/&gt;<br \/>\nJSONObject userInfo = [&lt;br \/&gt;<br \/>\n                         user:[&lt;br \/&gt;<br \/>\n                            id:212545455,&lt;br \/&gt;<br \/>\n                            profile_picture:http:\/\/images.ak.instagram.com\/profiles\/profile_120652151_75sq_545454125.jpg,&lt;br \/&gt;<br \/>\n                            username:abcdefg45,&lt;br \/&gt;<br \/>\n                            bio:,&lt;br \/&gt;<br \/>\n                            website:,&lt;br \/&gt;<br \/>\n                            full_name:abcd xyz&lt;br \/&gt;<br \/>\n                         ],&lt;br \/&gt;<br \/>\n                         access_token:122545212145.ddjsjdaa.002jdjwsdjdjdjndf7458&lt;br \/&gt;<br \/>\n                   ]&lt;\/p&gt;<br \/>\n&lt;p&gt;String instagramUserId = userInfo.user.id&lt;br \/&gt;<br \/>\nString accessToken = userInfo.access_token&lt;br \/&gt;<br \/>\n[\/code]<\/p>\n<p>Now using this information, we can get the followers of the Instagram user as follows:<\/p>\n<p>[code]&lt;br \/&gt;<br \/>\nString instagramFollowersUrl = &amp;quot;https:\/\/api.instagram.com\/v1\/users\/&amp;quot; + instagramUserId + &amp;quot;\/?access_token=&amp;quot; + accessToken&lt;br \/&gt;<br \/>\nURL url = new URL(queryString)&lt;br \/&gt;<br \/>\nreturn url.text&lt;br \/&gt;<br \/>\n[\/code]<\/p>\n<p>Too get all recent media posted by an Instagram user, the API call made is as follows:<\/p>\n<p>[code]&lt;\/p&gt;<br \/>\n&lt;p&gt;String clientId = &amp;quot;nbdnbd2372837283jfbjebf8384384&amp;quot; \/\/your registered application&#8217;s client_id&lt;br \/&gt;<br \/>\nString userMediaUrl = &amp;quot;https:\/\/api.instagram.com\/v1\/users\/&amp;quot; + instagramUserId + &amp;quot;\/media\/recent\/?client_id=&amp;quot;+clientId&lt;br \/&gt;<br \/>\nURL url = new URL(queryString)&lt;br \/&gt;<br \/>\nreturn url.text&lt;br \/&gt;<br \/>\n[\/code]<\/p>\n<p>To learn more about it you can follow the link <a href=\"http:\/\/instagram.com\/developer\">http:\/\/instagram.com\/developer<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my previous blog we learnt how to integrate Instagram login functionality in a Grails web app. Now we will see how to get Instagram user&#8217;s followers and media. Once a user is logged in via the Instagram login API, we get a JSON response containing the logged in user&#8217;s profile information in JSON Format. [&hellip;]<\/p>\n","protected":false},"author":72,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":53,"footnotes":""},"categories":[7],"tags":[],"class_list":["post-12731","post","type-post","status-publish","format-standard","hentry","category-grails"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"In my previous blog we learnt how to integrate Instagram login functionality in a Grails web app. Now we will see how to get Instagram user&#039;s followers and media. Once a user is logged in via the Instagram login API, we get a JSON response containing the logged in user&#039;s profile information in JSON Format.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Komal Jain\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/2thenew.xyz\/blog\/instagram-api-fetch-users-followers-and-media\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"Instagram API: Fetch user\u2019s followers and media | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"In my previous blog we learnt how to integrate Instagram login functionality in a Grails web app. Now we will see how to get Instagram user&#039;s followers and media. Once a user is logged in via the Instagram login API, we get a JSON response containing the logged in user&#039;s profile information in JSON Format.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/2thenew.xyz\/blog\/instagram-api-fetch-users-followers-and-media\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Instagram API: Fetch user\u2019s followers and media | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"In my previous blog we learnt how to integrate Instagram login functionality in a Grails web app. Now we will see how to get Instagram user&#039;s followers and media. Once a user is logged in via the Instagram login API, we get a JSON response containing the logged in user&#039;s profile information in JSON Format.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/instagram-api-fetch-users-followers-and-media\\\/#article\",\"name\":\"Instagram API: Fetch user\\u2019s followers and media | TO THE NEW Blog\",\"headline\":\"Instagram API: Fetch user&#8217;s followers and media\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/komal\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2014-04-04T01:57:21+05:30\",\"dateModified\":\"2014-04-04T01:57:21+05:30\",\"inLanguage\":\"en-US\",\"commentCount\":1,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/instagram-api-fetch-users-followers-and-media\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/instagram-api-fetch-users-followers-and-media\\\/#webpage\"},\"articleSection\":\"Grails\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/instagram-api-fetch-users-followers-and-media\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/#listItem\",\"name\":\"Grails\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/#listItem\",\"position\":2,\"name\":\"Grails\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/instagram-api-fetch-users-followers-and-media\\\/#listItem\",\"name\":\"Instagram API: Fetch user&#8217;s followers and media\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/instagram-api-fetch-users-followers-and-media\\\/#listItem\",\"position\":3,\"name\":\"Instagram API: Fetch user&#8217;s followers and media\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/#listItem\",\"name\":\"Grails\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/komal\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/komal\\\/\",\"name\":\"Komal Jain\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/instagram-api-fetch-users-followers-and-media\\\/#authorImage\",\"url\":\"https:\\\/\\\/newersworld-sf-static.tothenew.net\\\/prod\\\/profilePicFolder\\\/6e680a75-b4b5-46c3-b118-6780ee85a9e2_komal.jain@tothenew.com.jpg\",\"width\":96,\"height\":96,\"caption\":\"Komal Jain\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/instagram-api-fetch-users-followers-and-media\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/instagram-api-fetch-users-followers-and-media\\\/\",\"name\":\"Instagram API: Fetch user\\u2019s followers and media | TO THE NEW Blog\",\"description\":\"In my previous blog we learnt how to integrate Instagram login functionality in a Grails web app. Now we will see how to get Instagram user's followers and media. Once a user is logged in via the Instagram login API, we get a JSON response containing the logged in user's profile information in JSON Format.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/instagram-api-fetch-users-followers-and-media\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/komal\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/komal\\\/#author\"},\"datePublished\":\"2014-04-04T01:57:21+05:30\",\"dateModified\":\"2014-04-04T01:57:21+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Instagram API: Fetch user\u2019s followers and media | TO THE NEW Blog","description":"In my previous blog we learnt how to integrate Instagram login functionality in a Grails web app. Now we will see how to get Instagram user's followers and media. Once a user is logged in via the Instagram login API, we get a JSON response containing the logged in user's profile information in JSON Format.","canonical_url":"https:\/\/2thenew.xyz\/blog\/instagram-api-fetch-users-followers-and-media\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/2thenew.xyz\/blog\/instagram-api-fetch-users-followers-and-media\/#article","name":"Instagram API: Fetch user\u2019s followers and media | TO THE NEW Blog","headline":"Instagram API: Fetch user&#8217;s followers and media","author":{"@id":"https:\/\/2thenew.xyz\/blog\/author\/komal\/#author"},"publisher":{"@id":"https:\/\/2thenew.xyz\/blog\/#organization"},"datePublished":"2014-04-04T01:57:21+05:30","dateModified":"2014-04-04T01:57:21+05:30","inLanguage":"en-US","commentCount":1,"mainEntityOfPage":{"@id":"https:\/\/2thenew.xyz\/blog\/instagram-api-fetch-users-followers-and-media\/#webpage"},"isPartOf":{"@id":"https:\/\/2thenew.xyz\/blog\/instagram-api-fetch-users-followers-and-media\/#webpage"},"articleSection":"Grails"},{"@type":"BreadcrumbList","@id":"https:\/\/2thenew.xyz\/blog\/instagram-api-fetch-users-followers-and-media\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog#listItem","position":1,"name":"Home","item":"https:\/\/2thenew.xyz\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/category\/grails\/#listItem","name":"Grails"}},{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/category\/grails\/#listItem","position":2,"name":"Grails","item":"https:\/\/2thenew.xyz\/blog\/category\/grails\/","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/instagram-api-fetch-users-followers-and-media\/#listItem","name":"Instagram API: Fetch user&#8217;s followers and media"},"previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/instagram-api-fetch-users-followers-and-media\/#listItem","position":3,"name":"Instagram API: Fetch user&#8217;s followers and media","previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/category\/grails\/#listItem","name":"Grails"}}]},{"@type":"Organization","@id":"https:\/\/2thenew.xyz\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/2thenew.xyz\/blog\/"},{"@type":"Person","@id":"https:\/\/2thenew.xyz\/blog\/author\/komal\/#author","url":"https:\/\/2thenew.xyz\/blog\/author\/komal\/","name":"Komal Jain","image":{"@type":"ImageObject","@id":"https:\/\/2thenew.xyz\/blog\/instagram-api-fetch-users-followers-and-media\/#authorImage","url":"https:\/\/newersworld-sf-static.tothenew.net\/prod\/profilePicFolder\/6e680a75-b4b5-46c3-b118-6780ee85a9e2_komal.jain@tothenew.com.jpg","width":96,"height":96,"caption":"Komal Jain"}},{"@type":"WebPage","@id":"https:\/\/2thenew.xyz\/blog\/instagram-api-fetch-users-followers-and-media\/#webpage","url":"https:\/\/2thenew.xyz\/blog\/instagram-api-fetch-users-followers-and-media\/","name":"Instagram API: Fetch user\u2019s followers and media | TO THE NEW Blog","description":"In my previous blog we learnt how to integrate Instagram login functionality in a Grails web app. Now we will see how to get Instagram user's followers and media. Once a user is logged in via the Instagram login API, we get a JSON response containing the logged in user's profile information in JSON Format.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/2thenew.xyz\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/2thenew.xyz\/blog\/instagram-api-fetch-users-followers-and-media\/#breadcrumblist"},"author":{"@id":"https:\/\/2thenew.xyz\/blog\/author\/komal\/#author"},"creator":{"@id":"https:\/\/2thenew.xyz\/blog\/author\/komal\/#author"},"datePublished":"2014-04-04T01:57:21+05:30","dateModified":"2014-04-04T01:57:21+05:30"},{"@type":"WebSite","@id":"https:\/\/2thenew.xyz\/blog\/#website","url":"https:\/\/2thenew.xyz\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/2thenew.xyz\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"Instagram API: Fetch user\u2019s followers and media | TO THE NEW Blog","og:description":"In my previous blog we learnt how to integrate Instagram login functionality in a Grails web app. Now we will see how to get Instagram user's followers and media. Once a user is logged in via the Instagram login API, we get a JSON response containing the logged in user's profile information in JSON Format.","og:url":"https:\/\/2thenew.xyz\/blog\/instagram-api-fetch-users-followers-and-media\/","og:image":"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Instagram API: Fetch user\u2019s followers and media | TO THE NEW Blog","twitter:description":"In my previous blog we learnt how to integrate Instagram login functionality in a Grails web app. Now we will see how to get Instagram user's followers and media. Once a user is logged in via the Instagram login API, we get a JSON response containing the logged in user's profile information in JSON Format.","twitter:image":"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"12731","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2021-04-29 13:24:30","updated":"2024-02-29 08:44:21","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.xyz\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.xyz\/blog\/category\/grails\/\" title=\"Grails\">Grails<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tInstagram API: Fetch user\u2019s followers and media\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/2thenew.xyz\/blog"},{"label":"Grails","link":"https:\/\/2thenew.xyz\/blog\/category\/grails\/"},{"label":"Instagram API: Fetch user&#8217;s followers and media","link":"https:\/\/2thenew.xyz\/blog\/instagram-api-fetch-users-followers-and-media\/"}],"_links":{"self":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/posts\/12731","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/users\/72"}],"replies":[{"embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/comments?post=12731"}],"version-history":[{"count":0,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/posts\/12731\/revisions"}],"wp:attachment":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/media?parent=12731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/categories?post=12731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/tags?post=12731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}