Created
July 7, 2016 09:56
-
-
Save devudit/3ec813a4a0a572c9fa628e89e7bb801b to your computer and use it in GitHub Desktop.
Get Instagram image data using javascript/jquery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var token = '<access_token>', | |
hashtag='<tag>', // hashtag without # symbol | |
num_photos = 4; | |
$.ajax({ | |
url: 'https://api.instagram.com/v1/tags/' + hashtag + '/media/recent', | |
dataType: 'jsonp', | |
type: 'GET', | |
data: {access_token: token, count: num_photos}, | |
success: function(data){ | |
console.log(data); | |
}, | |
error: function(data){ | |
console.log(data); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var token = '<access_token>', | |
userid = '<user_id>', // User ID - get it in source HTML of your Instagram profile :) | |
num_photos = 4; // how much photos do you want to get | |
$.ajax({ | |
url: 'https://api.instagram.com/v1/users/' + userid + '/media/recent', // or /users/self/media/recent for Sandbox | |
dataType: 'jsonp', | |
type: 'GET', | |
data: {access_token: token, count: num_photos}, | |
success: function(data){ | |
console.log(data); | |
}, | |
error: function(data){ | |
console.log(data); // send the error notifications to console | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment