|
|
A lightweight Friendster API client implemented in Java developed by TripAdvisor
Client compatibility with Friendster spec
| method | type | description | completed |
| /token | POST | Create a new token that can be exchanged for a session after the user logs in. | yes |
| /session | POST | Create a new API Session. | no |
| /user | GET | Get User Information for the logged in user. | yes |
| /user/:uids | GET | Get User Information for users in :uids list. | yes |
| /friends/:uid | GET | Get user's friend list. | yes |
| /depth/:uid1,:uid2 | GET | Get relation depth (distance) between two users. | yes |
| /photos/:uid | GET | Get user's photos. | yes |
| /photos/ | GET | Get photos for the current logged in user. | yes |
| /photos/:uid | POST | Uploads a photo for the specified user. | no |
| /photos/ | POST | Uploads a photo for the current logged in user. | no |
| /photo/:uid/:pid | GET | Get a user's photo. | yes |
| /photo/:pid | GET | Get a photo for the current logged in user. | yes |
| /photo/:pid | PUT | Modify photo attributes. | no |
| /primaryphoto/:uid | GET | Get a user's primary photo. | yes |
| /primaryphoto/ | GET | Get the primary photo for the current logged in user. | yes |
| /photo/:pid | DELETE | Deletes a user's photos. | no |
| /shoutout/:uid | GET | Get a user's shoutout. | yes |
| /shoutout/ | GET | Get the shoutout for the current user. | yes |
| /shoutout/ | POST | Update a user's shoutout. | yes |
| /widget | POST | Update widget's profile content for the logged in user. | yes |
Project Changelog
Version 0.3 (planned)Version 0.2
- Finish photo API calls
- Unit testing
- Finish javadoc
- Improve deployment to Google code
Version 0.1
- Added shoutout methods
- Finished all read methods on photos
- Support for API calls with multiple uids
- Package and deployment fixes
- Initial release of code
Example Usage
FriendsterClient fc = new FriendsterClient(<sessionKey>, <apiKey>, <secretKey>);
XPath xpath = XPathFactory.newInstance().newXPath();
try
{
Document doc = fc.getUser(9120940);
String firstName = xpath.evaluate("/user_response/user/first_name", doc);
String lastName = xpath.evaluate("/user_response/user/last_name", doc);
System.out.println(firstName + " " + lastName);
List<Integer> friends = fc.getFriends(9120940);
Document doc = fc.getUsers(friends);
NodeList nl = (NodeList) xpath.evaluate("/user_response/user", doc, XPathConstants.NODESET);
for (int i = 0;i < nl.getLength();i++)
{
System.out.println("profile url [" + i + "]: " + xpath.evaluate("url", nl.item(i)));
}
}
catch (Exception e)
{
System.err.println(e);
}
