How to get Facebook page shared posts rather than feeds for Ionic Framework?

Issue

.controller('FeedCtrl', function ($scope, $http, $stateParams, OpenFB, $ionicLoading, $ionicScrollDelegate) {

            $scope.show = function () {
                $scope.loading = $ionicLoading.show({
                    content: 'Loading feed...'
                });
            };
            $scope.hide = function () {
                $ionicLoading.loading.hide();
            };
            function loadFeed()
            {
                $scope.show();
                OpenFB.get('/107621857718/feed', {limit: 5})
                        .success(function (result) {
                            $ionicLoading.hide();
                            $scope.loaded = result.data;
                            // Used with pull-to-refresh
                            //$scope.loaded = [];
                            $scope.$broadcast('scroll.infiniteScrollComplete');
                        })
                        .error(function (data) {
                            $ionicLoading.hide();
                            alert(data.error.message);
                        });


            }
            ;
            $scope.checkScroll = function () {

                var currentTop = $ionicScrollDelegate.$getByHandle('libScroll').getScrollPosition().top;
                var maxTop = $ionicScrollDelegate.$getByHandle('libScroll').getScrollView().__maxScrollTop;

                if ((currentTop >= maxTop) && (!$scope.libraryLoading))
                {
                    loadMore();
                }
            };
            function loadMore()
            {

                $scope.show();
                OpenFB.get('/107621857718/feed')
                        .success(function (result) {

                            $ionicLoading.hide();
                            $scope.loaded = result.data;
                            // Used with pull-to-refresh

                            $scope.$broadcast('scroll.infiniteScrollComplete');

                        })

                        .error(function (data) {
                            $ionicLoading.hide();
                            alert(data.error.message);
                        });
            }

            $scope.doRefresh = loadFeed;
            loadFeed();



        });

For above part I am getting posts which is given by other users to page but I want posts shared by page.

Solution

You need to use /{page_id}/posts if you only want the Page’s posts.

See

/{page-id}/posts shows only the posts that were published by this page.

As the last post is from 2012, apparantly the since parameter has to be added to receive results:

/107621857718/posts?since=1325376000

will get all the posts from January 1st 2012 on.

https://developers.facebook.com/tools/explorer?method=GET&path=107621857718%2Fposts%3Fsince%3D1325376000&

Answered By – Tobi

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published