How to display Instagram Profile Picture with their API

35,486

Here is the simplest way to get profile picture using instagram API with javascript/jquery.

Replace ACCESS_TOKEN with you access token and set USER_ID to the instagram user id you want profile picture.

<html>
<head>
  <title>Instagram</title>
  <script src="http://codeorigin.jquery.com/jquery-2.0.3.min.js"></script>
  <script type="text/javascript">
var access_token = "ACCESS_TOKEN";   
var user_id = "USER_ID";
var url = "https://api.instagram.com/v1/users/"+user_id+"?access_token="+access_token+"&callback=?";
$.getJSON(url, function(data) {
    $("body").append("<img src='"+data.data.profile_picture+"' />");
});
  </script>
</head>
<body>
</body>
</html>
Share:
35,486
Billy Rammal
Author by

Billy Rammal

Updated on September 27, 2020

Comments

  • Billy Rammal
    Billy Rammal over 3 years

    I've been trying and researching this for a while now, to no avail.

    All I want is a simple method (without using someone else's messy API) to request a user's profile picture. I have the authentication and everything setup, I just don't understand how to call other information.

    The documentation is confusing to me, first time using an API: http://instagram.com/developer/endpoints/users/#get_users

    Any ideas?