Spring Social Facebook

org.springframework.social.facebook.api
Interface PageOperations


public interface PageOperations

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

Author:
Craig Walls

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

Method Detail

getPage

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

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

isPageAdmin

boolean isPageAdmin(java.lang.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

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


post

java.lang.String post(java.lang.String pageId,
                      java.lang.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

java.lang.String post(java.lang.String pageId,
                      java.lang.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

java.lang.String postPhoto(java.lang.String pageId,
                           java.lang.String albumId,
                           org.springframework.core.io.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

java.lang.String postPhoto(java.lang.String pageId,
                           java.lang.String albumId,
                           org.springframework.core.io.Resource photo,
                           java.lang.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.

Spring Social Facebook