In this article we will learn how to get Instagram images using Instagram API. First off, we need to get the Instagram client id. Please follow these simple steps to get the Instagram client id:
Step 1: Login on Instagram.
Step 2: Click on API link in footer or directly open url.
Step 3: Click on Register Your Application,

Step 4: Developer Signup will open.

Step 5: Fill your website, phone number, and what you want to build with the API.
Step 6: Click on Sign up button
Step 7: Register new client id will open. Fill the form and click on register.
Step 8: Now you will get client id as below:

Now write the following code to get images using Instragram API.
- <script src='<%= ResolveUrl("~/Scripts/jquery-1.7.1.min.js")%>' type="text/javascript"></script>
- <script type="text/jscript">
- var clientsId = "clientid"; //instagram client id is here (xxx44662ae4a4ffxxx321e0f178a6xxx)
- function GetPhoto() {
- if ($.trim($("#TextBoxInstagram").val()) != "") {
- GetUserIdFromInstragram($.trim($("#TextBoxInstagram").val()));
- }
- }
- function GetUserIdFromInstragram(InstragramUrl) {
- var stringLength = InstragramUrl.length; // this will be 16
- var lastChar = InstragramUrl.charAt(stringLength - 1); // th
- if (lastChar == "/") {
- InstragramUrl = InstragramUrl.substring(0, InstragramUrl.length - 1);
- }
- var Username = InstragramUrl.substr(InstragramUrl.lastIndexOf('/') + 1);
- $.ajax({
- type: "GET",
- url: "https://api.instagram.com/v1/users/search?q=" + Username + "&client_id=" + clientsId + "",
- dataType: "jsonp",
- crossDomain: true,
- beforeSend: function () {
- },
- complete: function () {
- },
- success: function (data) {
- GetPhotoFromInstragram(data["data"][0]["id"])
- }
- });
- }
- // This method is used to get Photos from Instragram with the help of user id and clients id
- function GetPhotoFromInstragram(UserId) {
- jQuery("#MyInstagramPhoto").html("");
- $.ajax({
- type: "GET",
- url: "https://api.instagram.com/v1/users/" + UserId + "/media/recent/?client_id=" + clientsId + "&count=12",
- dataType: "jsonp",
- crossDomain: true,
- beforeSend: function () {
- ShowLoading();
- },
- complete: function () {
- HideLoading();
- },
- success: function (data) {
- if (data != "") {
- if (data["data"].length > 0) {
- for (var i = 0; i < data["data"].length; i++) {
- jQuery("#MyInstagramPhoto").append("<li><a href='" + data.data[i].link + "' target=\"_blank\"><img src='" + data.data[i].images.low_resolution.url + "' class=\"instpics small\" /></a></li>");
- }
- }
- }
- }
- });
- }
- function ShowLoading() {
- var scrollTop = jQuery(window).scrollTop();
- jQuery('.overlay-bg').show();
- return true;
- }
- function HideLoading() {
- jQuery("#divoverlay").hide();
- }
- </script>
- <style type="text/css">
- /*For loader and masking */
- .overlay-bg
- {
- display: none;
- position: absolute;
- top: 0;
- left: 0;
- z-index: 1000;
- background: black !important;
- opacity: 0.30;
- height: 100%;
- width: 100%;
- }
- .overlay-content
- {
- background: #fff;
- padding: 1%;
- width: 32px;
- height: 32px;
- position: relative;
- cursor: default;
- border-radius: 4px;
- box-shadow: 0 0 5px rgba(0,0,0,0.9);
- left: 50%;
- top: 20% !important;
- }
- /* style for Image */
- ul.ImageStyle li
- {
- list-style-type: none;
- width: 24%;
- float: left;
- padding: 1px 5px 0px 0px;
- border: none;
- }
- .instpics
- {
- width: 100%;
- }
- </style>
- <div class="row" id="divInstagram">
- <div>
- Instagram Url
- <input type="text" id="TextBoxInstagram" placeholder="Enter your instagram url" style="width: 300px" />
- <input type="button" onclick="GetPhoto(); return false;" value="Get Instagram Photos" />
- </div>
- <div>
- <%--display Images--%>
- <ul id="MyInstagramPhoto" class="ImageStyle">
- </ul>
- </div>
- </div>
- <%--Masking- This div will hide content untill data will fetch--%>
- <div class="overlay-bg" id="divoverlay">
- <div class="overlay-content">
- <img src="<%= ResolveUrl("~/images/loader.gif") %>" alt="loading" />
- </div>
- </div>

Enter your instagram url and click on 'Get Instagram Photos' button. Now you will get Instagram images as follows:

Happy coding.
Read more articles on jQuery:

Imam NPosted Sep 17, 2018, 5:17 AM
Hai. How to Get Instagram Videos using c# and Jquery
SubashPosted Sep 28, 2016, 7:53 AM
Super feature nice one sir
Praveen KumarPosted Aug 16, 2016, 11:19 AM
hi
Praveen KumarPosted Aug 16, 2016, 11:18 AM
hello sir nice article
Praveen KumarPosted Aug 16, 2016, 11:17 AM
hello
Omid NasriPosted Jun 23, 2016, 12:08 AM
Yes, the version author explained here is outdated and this article must be update now.
Bhuvanesh MohankumarPosted Jun 20, 2016, 11:54 AM
Omid Nasri Article expired means, the version author explained here is outdated?
Omid NasriPosted Jun 17, 2016, 6:51 AM
This article has expired
Thiruppathi RPosted May 22, 2016, 5:47 AM
Good Info..
Bhuvanesh MohankumarPosted May 12, 2016, 2:15 PM
Good one..
Manoj KulkarniPosted Apr 24, 2016, 12:23 AM
Nice article. Thank you for sharing
Omid NasriPosted Apr 23, 2016, 4:26 AM
like.
NitinPosted Apr 22, 2016, 11:46 PM
Good one
Debendra DashPosted Apr 22, 2016, 8:32 PM
nice.......
Vignesh ManiPosted Apr 22, 2016, 5:33 PM
Nice
Gowtham KPosted Apr 22, 2016, 12:55 PM
Good One, Thanks for sharing:)
Kuppurasu NagarajPosted Apr 22, 2016, 11:49 AM
Nice Sharing..
Debasis SahaPosted Apr 22, 2016, 10:16 AM
Good One..
Gowtham RajamanickamPosted Apr 22, 2016, 8:49 AM
good article..