org.springframework.social.facebook.api
Interface PageOperations


public interface PageOperations

Interface defining operations that can be performed on a Facebook pages.


Method Summary
 PagedList<Account> getAccounts()
          Retrieves a list of Account objects for the pages that the authenticated user is an administrator.
 Page getPage(String pageId)
          Retrieves data for a page.
 boolean isPageAdmin(String pageId)
          Checks whether the logged-in user for this session is an admin of the page with the given page ID.
 String post(String pageId, String message)
          Posts a message to a page's feed as a page administrator.
 String post(String pageId, String message, FacebookLink link)
          Posts a link to the page's feed as a page administrator.
 String postPhoto(String pageId, String albumId, Resource photo)
          Posts a photo to a page's album as the page administrator.
 String postPhoto(String pageId, String albumId, Resource photo, String caption)
          Posts a photo to a page's album as the page administrator.
 

Method Detail

getPage

Page getPage(String pageId)
Retrieves data for a page.

Parameters:
pageId - the page ID.
Returns:
a Page

isPageAdmin

boolean isPageAdmin(String pageId)
Checks whether the logged-in user for this session is an admin of the page with the given page ID. Requires "manage_pages" permission.

Parameters:
pageId - the page ID
Returns:
true if the authenticated user is an admin of the specified page.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "manage_pages" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getAccounts

PagedList<Account> getAccounts()
Retrieves a list of Account objects for the pages that the authenticated user is an administrator. Requires "manage_pages" permission.


post

String post(String pageId,
            String message)
Posts a message to a page's feed as a page administrator. Requires that the application is granted "manage_pages" permission and that the authenticated user be an administrator of the page. To post to the page's feed as the authenticated user, use FeedOperations.post(String, String) instead.

Parameters:
pageId - the page ID
message - the message to post
Returns:
the ID of the new feed entry
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "manage_pages" permission.
PageAdministrationException - if the user is not a page administrator.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

post

String post(String pageId,
            String message,
            FacebookLink link)
Posts a link to the page's feed as a page administrator. Requires that the application is granted "manage_pages" permission and that the authenticated user be an administrator of the page. To post a link to the page's feed as the authenticated user, use FeedOperations.postLink(String, String, FacebookLink) instead.

Parameters:
pageId - the page ID
message - a message to send with the link.
link - the link details
Returns:
the ID of the new feed entry.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "manage_pages" permission.
PageAdministrationException - if the user is not a page administrator.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

postPhoto

String postPhoto(String pageId,
                 String albumId,
                 Resource photo)
Posts a photo to a page's album as the page administrator. Requires that the application is granted "manage_pages" permission and that the authenticated user be an administrator of the page.

Parameters:
pageId - the page ID
albumId - the album ID
photo - A Resource for the photo data. The given Resource must implement the getFilename() method (such as FileSystemResource or ClassPathResource).
Returns:
the ID of the photo.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "manage_pages" permission.
PageAdministrationException - if the user is not a page administrator.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

postPhoto

String postPhoto(String pageId,
                 String albumId,
                 Resource photo,
                 String caption)
Posts a photo to a page's album as the page administrator. Requires that the application is granted "manage_pages" permission and that the authenticated user be an administrator of the page.

Parameters:
pageId - the page ID
albumId - the album ID
photo - A Resource for the photo data. The given Resource must implement the getFilename() method (such as FileSystemResource or ClassPathResource).
caption - A caption describing the photo.
Returns:
the ID of the photo.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "manage_pages" permission.
PageAdministrationException - if the user is not a page administrator.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.