net.sf.f8api
Class Url

java.lang.Object
  extended by net.sf.f8api.Url

public class Url
extends java.lang.Object

Author:
Jason Thrasher
See Also:
Other Functionality

Field Summary
protected static java.lang.String ADD_FRIEND
           
protected static java.lang.String GENERATE_AUTH_TOKEN
          Facebook page allowing user to generate an auth token that is entered into the app.
protected static java.lang.String LOGIN
          Longin url ?api_key=${api_key}&v=${v}
protected static java.lang.String MESSAGE
           
protected static java.lang.String NOTES
           
protected static java.lang.String PHOTO_SEARCH
           
protected static java.lang.String PHOTOS
           
protected static java.lang.String POKE
           
protected static java.lang.String PROFILE
           
protected static java.lang.String WALL
           
 
Constructor Summary
Url()
           
 
Method Summary
static java.lang.String getAddFriendUrl(java.lang.String userId)
          add the specified user as a friend
static java.lang.String getDesktopLoginUrl(java.lang.String apiKey, java.lang.String authToken, boolean popup, boolean skipCookie, boolean hideCheckbox)
          Get a login url for a desktop application.
static java.lang.String getLoginAuthTokenGenerationUrl(java.lang.String apiKey)
          Use the Facebook Token Generator to let the user create a token that is then set in our app manually by the user.
protected static java.lang.String getLoginUrl(java.lang.String apiVersion, java.lang.String apiKey, java.lang.String next, java.lang.String authToken, boolean popup, boolean skipCookie, boolean hideCheckbox, boolean toCanvas)
          Get a general login url.
static java.lang.String getMessageUrl(long userId, java.lang.String subject, java.lang.String message)
          send a message to the specified user.
static java.lang.String getNotesUrl(long userId)
          read the specified user's notes
static java.lang.String getPhotosOfUrl(long userId)
          see photos of the specified user
static java.lang.String getPhotosUrl(long userId)
          See photos taken by the specified user.
static java.lang.String getPokeUrl(long userId)
          poke the specified user
static java.lang.String getProfileUrl(long userId)
          view the specified user's profile
static java.lang.String getWallUrl(long userId)
          read or post on the specified user's wall
static java.lang.String getWebappLoginRedirectUrl(Application app, boolean toCanvas, java.lang.String next, java.lang.String authToken)
          Upon successful authentication, if the user has never logged in to this application before, he will be asked to accept the terms of service for using the application.
static java.lang.String getWebappLoginUrl(java.lang.String apiKey, java.lang.String next, boolean popup, boolean skipCookie, boolean hideCheckbox, boolean toCanvas)
          Get a login url for a webapp.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGIN

protected static final java.lang.String LOGIN
Longin url ?api_key=${api_key}&v=${v}

See Also:
Constant Field Values

PROFILE

protected static final java.lang.String PROFILE
See Also:
Constant Field Values

POKE

protected static final java.lang.String POKE
See Also:
Constant Field Values

MESSAGE

protected static final java.lang.String MESSAGE
See Also:
Constant Field Values

ADD_FRIEND

protected static final java.lang.String ADD_FRIEND
See Also:
Constant Field Values

PHOTOS

protected static final java.lang.String PHOTOS
See Also:
Constant Field Values

PHOTO_SEARCH

protected static final java.lang.String PHOTO_SEARCH
See Also:
Constant Field Values

WALL

protected static final java.lang.String WALL
See Also:
Constant Field Values

NOTES

protected static final java.lang.String NOTES
See Also:
Constant Field Values

GENERATE_AUTH_TOKEN

protected static final java.lang.String GENERATE_AUTH_TOKEN
Facebook page allowing user to generate an auth token that is entered into the app. This is used for Desktop apps to create infinite sessions.

See Also:
Constant Field Values
Constructor Detail

Url

public Url()
Method Detail

getWebappLoginUrl

public static java.lang.String getWebappLoginUrl(java.lang.String apiKey,
                                                 java.lang.String next,
                                                 boolean popup,
                                                 boolean skipCookie,
                                                 boolean hideCheckbox,
                                                 boolean toCanvas)
Get a login url for a webapp. The user should use the returned URL to login to this web based application. When using next="next" and toCanvas=true, the successful login redirect URL will take the user to something like: http://apps.facebook.com/appName/next?auth_token=e7e418a4cab359827ad98761b742af7b If the app's callBack page is configured for FBML, a request will be made by the Facebook server to: http://www.mycompany.com/some/path/callback.htmlnext?auth_token=e7e418a4cab359827ad98761b742af7b Example: If the callback url is: http://www.mycompany.com/callback/ And the next parameter is: success.html Then on a successful login the user will see the content of: http://www.mycompany.com/callback/success.html And when toCanvas == false they will be redirected to: http://www.mycompany.com/callback/success.html?auth_token=347d2d517bcc31650b7e3d3ee830bbcd Or when toCanvas == true they will be redirected to: http://apps.facebook.com/appName/success.html?auth_token=e7e418a4cab359827ad98761b742af7b Which will render FBML or iFrame content, based on how the app was configured at Facebook.

Parameters:
apiKey -
next - is usually the callback-filename the user should redirect to after they login
popup -
skipCookie -
hideCheckbox -
toCanvas -
Returns:

getDesktopLoginUrl

public static java.lang.String getDesktopLoginUrl(java.lang.String apiKey,
                                                  java.lang.String authToken,
                                                  boolean popup,
                                                  boolean skipCookie,
                                                  boolean hideCheckbox)
Get a login url for a desktop application.

Parameters:
apiKey -
authToken -
popup -
skipCookie - if true, the user will have to login again even for infinite sessions
hideCheckbox -
Returns:

getLoginUrl

protected static java.lang.String getLoginUrl(java.lang.String apiVersion,
                                              java.lang.String apiKey,
                                              java.lang.String next,
                                              java.lang.String authToken,
                                              boolean popup,
                                              boolean skipCookie,
                                              boolean hideCheckbox,
                                              boolean toCanvas)
Get a general login url. Supports all parameters, even though combinations of desktop and webapp parameters are not allowed.

Parameters:
apiVersion - The version of the API you are using. Should be set to "1.0". Required.
apiKey - Uniquely assigned to the vendor, and identifies, among other things, the list of acceptable source IPs for this call. Required.
next - A way for web based applications to preserve some state for this login - this will get appended to their callback_url after the user logs in as described below. Optional.
authToken - Before generating the login URL, the desktop application should call the facebook.auth.createToken API function, and then use the auth_token returned by that function here. Required for desktop apps.
popup - set true to use an alternative style for the login page that does not contain any Facebook navigational elements. For the best results, the pop-up should ideally have the following dimensions: width=646 pixels, height=436 pixels. Optional (default is false).
skipCookie - Pass this in to allow a user to re-enter their login information. This may be useful if another Facebook user previously forgot to logout. Optional(default is false).
hideCheckbox - Pass this in to hide the "Save my login info" checkbox from the user. This may be useful if your application does not wish to persist the user's session information. See the "Infinite Sessions" section below for more info. Optional (default is false).
toCanvas - If you pass this parameter, we will use your canvas page URL instead of your callback URL as the base for the URL we redirect the user to. Optional (default is false).
Returns:
The string url with CGI parameters.

getWebappLoginRedirectUrl

public static java.lang.String getWebappLoginRedirectUrl(Application app,
                                                         boolean toCanvas,
                                                         java.lang.String next,
                                                         java.lang.String authToken)
Upon successful authentication, if the user has never logged in to this application before, he will be asked to accept the terms of service for using the application. Finally, for web-based applications, the user is redirected to the site callback_url + next + separator + 'auth_token=______' with these values.

Parameters:
app -
toCanvas - Use the same value as for getLoginUrl. If true, redirect will point to the canvas page you set up (which will then indirectly result in a request going to your callback_url).
next - Use the same value as for getLoginUrl.
authToken -
Returns:

getLoginAuthTokenGenerationUrl

public static java.lang.String getLoginAuthTokenGenerationUrl(java.lang.String apiKey)
Use the Facebook Token Generator to let the user create a token that is then set in our app manually by the user.

Parameters:
apiKey -
Returns:

getProfileUrl

public static java.lang.String getProfileUrl(long userId)
view the specified user's profile

Parameters:
userId -
Returns:

getPokeUrl

public static java.lang.String getPokeUrl(long userId)
poke the specified user

Parameters:
userId -
Returns:

getMessageUrl

public static java.lang.String getMessageUrl(long userId,
                                             java.lang.String subject,
                                             java.lang.String message)
send a message to the specified user. subject and msg parameters are optional ways to pre-fill the contents of the message (the user will still be able to edit the message before sending). ?id=${id}&subject=${subject}&msg=${msg}

Parameters:
userId - the user ID to send the message to
subject - the pre-loaded message subject, or null for none
body - the pre-loaded message body, or null for none
Returns:

getAddFriendUrl

public static java.lang.String getAddFriendUrl(java.lang.String userId)
add the specified user as a friend

Parameters:
userId -
Returns:

getPhotosUrl

public static java.lang.String getPhotosUrl(long userId)
See photos taken by the specified user.

Parameters:
userId -
Returns:

getPhotosOfUrl

public static java.lang.String getPhotosOfUrl(long userId)
see photos of the specified user

Parameters:
userId -
Returns:

getWallUrl

public static java.lang.String getWallUrl(long userId)
read or post on the specified user's wall

Parameters:
userId -
Returns:

getNotesUrl

public static java.lang.String getNotesUrl(long userId)
read the specified user's notes

Parameters:
userId -
Returns:


Copyright © 2007 Jason Thrasher. All Rights Reserved.