I would like to have the recent posts of an specific user, like Banksy. I came up with the following, but it will give me an error of:
GET /?access_token={token}&callback=jQuery11110924438442569226_1445956181244&_=1445956181245
My ajax call looks like this:
$.ajax({
type: "GET",
dataType: "jsonp",
cache: false,
url: "/?access_token={token}",
success: function(response) {
console.log('jfsdahuifhasudh')
console.log(response);
// placing the images on the page
// for (var i = 0; i < 6; i++) {
var html = '<a href="' + response.data[i].link + '" >'+
'<img src="' + response.data[i].images.low_resolution.url + '" alt="thumbnail" /></a>';
$(".instafeed").html(html);
// }
},
error: function(data) {
console.log('We have a problem!');
}
});
I would like to have the recent posts of an specific user, like Banksy. I came up with the following, but it will give me an error of:
GET https://api.instagram./v1/users/banksy/media/recent/?access_token={token}&callback=jQuery11110924438442569226_1445956181244&_=1445956181245
My ajax call looks like this:
$.ajax({
type: "GET",
dataType: "jsonp",
cache: false,
url: "https://api.instagram./v1/users/banksy/media/recent/?access_token={token}",
success: function(response) {
console.log('jfsdahuifhasudh')
console.log(response);
// placing the images on the page
// for (var i = 0; i < 6; i++) {
var html = '<a href="' + response.data[i].link + '" >'+
'<img src="' + response.data[i].images.low_resolution.url + '" alt="thumbnail" /></a>';
$(".instafeed").html(html);
// }
},
error: function(data) {
console.log('We have a problem!');
}
});
Share
Improve this question
edited Jul 13, 2020 at 14:05
Farsad
5216 silver badges14 bronze badges
asked Oct 27, 2015 at 14:32
CaspertCaspert
4,36316 gold badges67 silver badges111 bronze badges
4
- 1 what error are you getting? – Brian Glaz Commented Oct 27, 2015 at 14:33
- This one: GET api.instagram./v1/users/banksy/media/recent/……1f641437&callback=jQuery11110924438442569226_1445956181244&_=1445956181245 – Caspert Commented Oct 27, 2015 at 14:34
-
What about it? @Caspert, I believe you're not able to parse the
JSON
correctly, right? – Adam Azad Commented Oct 27, 2015 at 14:40 - The url is returning a 404 meaning the resource is not found. – lharby Commented Oct 27, 2015 at 14:43
1 Answer
Reset to default 4You're using the username in your query; banksy
in your case. Resolve the username
into ID then use the id
in your query. For example;
https://api.instagram./v1/users/45951573/media/recent/?access_token={token}
*The API will return posts only if the account is public.
Edit
To get posts tagged with a specific hashtag use:
https://api.instagram./v1/tags/{tag-name}/media/recent?access_token={token}
Further reading: Instagram API; Tags
Update
instaJS is a jQuery plugin I wrote in past. What makes this plugin unique is that it accepts username
instead of forcing users to resolve their id
. Completely Free to use :), and of course contribution is always weled InstaJS on Github