How can we merge result of two instagram API

245 Views Asked by At

I need to show Instagram Image on a web page based on UserName and Tags

After looking around and searching for such api i couldn't find which can allow me following

  1. Show Images based on User Account +
  2. Show images based on Tags (Single or multiple)

I can use two separate API calls to show both results separately but i am not sure how to merge both results and show them as one based on latest images.

Example based on angular and instgram API http://codepen.io/anon/pen/qdrBMQ?editors=001

I also looked at instafeedjs It allows to show images based on UserAccount and Filter same result based on Tags Example: http://codepen.io/anon/pen/NqpWER?editors=001

Any such example where i can show images from User Account + Any Tag(s).

1

There are 1 best solutions below

4
On BEST ANSWER

Merging shouldn't be too hard:

var byUserUrl = 'https://api.instagram.com/v1/users/828057799/media/recent/?client_id=5e7cb176cc4340c09124d9f50733f34f&callback=JSON_CALLBACK';

//Search by tag
var byTagUrl ='https://api.instagram.com/v1/tags/flight/media/recent/?client_id=5e7cb176cc4340c09124d9f50733f34f&callback=JSON_CALLBACK';

app.controller("InstagramCtrl", function InstagramCtrl($scope, $http) {
  $scope.photos = [];
  $http.jsonp(byUserUrl).success(function(data) {
    $scope.photos = $scope.photos.concat(data.data);
  });
  $http.jsonp(byTagUrl).success(function(data) {
    $scope.photos = $scope.photos.concat(data.data);
  });
});

http://codepen.io/anon/pen/Qbpwmm