Friendster JSON client in Java
Simple lightweight Friendster JSON client in Java.
Download Friendster JSON Client (zip, 16 kb)
Dependence: Google JSON library (http://code.google.com/p/google-gson/)
/token |
POST |
Create a new token that can be exchanged for a session after the user logs in. |
yes |
postToken |
/session |
POST |
Create a new API Session. |
yes |
getSession |
/user |
GET |
Get User Information for the logged in user. |
yes |
getUser |
/user/:uids |
GET |
Get User Information for users in :uids list. |
yes |
getUser |
/application/friends |
GET |
Get friends who also installed the current application. |
yes* |
getApplicationFriends |
/fans/:uid |
GET |
Get a fan profile's fan list. |
yes* |
getFans |
/friends/:uid |
GET |
Get user's friend list. |
yes |
getFriends |
/depth/:uid1,:uid2 |
GET |
Get relation depth (distance) between two users. |
yes |
getDepth |
/photos/:uid |
GET |
Get user's photos. |
yes |
getPhotos |
/photos/ |
GET |
Get photos for the current logged in user. |
yes |
getPhotos |
/photos/:uid |
POST |
Uploads a photo for the specified user. |
yes* |
postPhotos |
/photos/ |
POST |
Uploads a photo for the current logged in user. |
yes* |
postPhotos |
/photo/:uid/:pid |
GET |
Get a user's photo. |
yes |
getPhotos |
/photo/:pid |
GET |
Get a photo for the current logged in user. |
yes |
getPhotos |
/photo/:pid |
PUT |
Modify photo attributes. |
yes |
putPhoto |
/primaryphoto/:uid |
GET |
Get a user's primary photo. |
yes |
getPrimaryPhotos |
/primaryphoto/ |
GET |
Get the primary photo for the current logged in user. |
yes |
getPrimaryPhotos |
/photo/:pid |
DELETE |
Deletes a user's photos. |
yes* |
deletePhoto |
/albums/:uid |
GET |
Gets the user's albums. |
yes |
getAlbums |
/albums/ |
GET |
Gets the current user's albums. |
yes |
getAlbums |
/album/ |
POST |
Creates an album. |
yes |
postAlbum |
/album/:aid |
DELETE |
Deletes an album. |
yes* |
deleteAlbum |
/shoutout/:uids |
GET |
Get shoutouts for users in :uids list. |
yes |
getShoutout |
/shoutout/ |
GET |
Get the shoutout for the current user. |
yes |
getShoutout |
/shoutout/ |
POST |
Update a user's shoutout. |
yes |
postShoutout |
/widget |
POST |
Update widget's profile content for the logged in user. |
yes |
postWidget |
/widget |
GET |
Get widget content and title for the logged in user. |
yes |
getWidget |
/notification |
POST |
Post a notification |
yes |
postNotification |
* – this methods returns server error. If you known how fix this bugs, please contact with me expert@kurta.ru
How it work
1. friendster redirect to your callback url:
<callback url>?auth_token=84974fb8d8b4b51.81456953&api_key=f8622314996ca1520f5cbbdb0889f501&lang=en-US&src=login&user_id=89490403&nonce=1232403341.5738&sig=391bf40394dc73baa7a9c19721d14421
2. Get session
public static final String FS_API_KEY = "f8622314996ca1520f5cbbdb0889f501";
public static final String FS_SECRET_KEY = "f9801946499bf9878c42aa4a6edc5a2b";
String fsToken = request.getParameter("auth_token")
FriendsterJsopClient friendsterClient = new FriendsterJsopClient(null, Constants.FS_API_KEY, Constants.FS_SECRET_KEY);
SessionResponse sessionResponse = friendsterClient.getSession(fsToken);
String fsSession = sessionResponse.getSessionKey();
3. Use this session key for using other function
FriendsterJsopClient friendsterClient = new FriendsterJsopClient(sessionKey, Constants.FS_API_KEY, Constants.FS_SECRET_KEY);
List<Photo> frPhotos = friendsterClient.getPhotos(user_id, album_id);