facebook rest api java简单实现

宗政兴发
2023-12-01

facebook old rest api java版本的简单实现,可以获取用户信息和好友信息,更多功能可以自己添加。代码见附件

		FaceBookRestAPIClient client = new FaceBookRestAPIClient("appid", 
				"apiKey", "secretKey", 
				"sessionKey");
		client.setMethod(HTTP_METHOD.GET);
		
		String userId = client.getLoginUser();
		User u = client.getUserInfo(userId);
		System.out.println(u.getName());
		String[] ids = client.getAppFriends();
		System.out.println(ids.length);
		
		ids = client.getAllFriends();
		System.out.println(ids.length);
		
		User[] us = client.getUserInfo(ids);
		System.out.println(us.length);
		
		boolean b = client.isFriend("100001499800360", userId); 
		System.out.println(b);
 类似资料: