Hi All,
My requirement is to get a list of Myspace friends and display it on Jsp page. I refered to this link http://code.google.com/p/opensocial-java-client/source/browse/trunk/java/samples/DisplayFriends.java
and wrote my own code as follows
import org.opensocial.data.OpenSocialPerson;
import org.opensocial.client.OpenSocialClient;
import java.util.Collection;
public class DisplayMyspaceFriends{
public static void main(String[ args) {
OpenSocialClient c = new OpenSocialClient("http://www.myspace.com");
c.setProperty(OpenSocialClient.Properties.RPC_ENDPOINT, "http://api.myspace.com/v2/");
c.setProperty(OpenSocialClient.Properties.CONSUMER_SECRET, "----------My secret Key...........................");
c.setProperty(OpenSocialClient.Properties.CONSUMER_KEY, "http://www.myspace.com/-------My consumer key ID--------");
c.setProperty(OpenSocialClient.Properties.VIEWER_ID,"--------my id-------");
try
{
// OpenSocialPerson osp = c.fetchPerson(); System.out.println("OSP name "+osp.getDisplayName());
Collection<OpenSocialPerson> friends = c.fetchFriends("--------my id--------");
System.out.println("---------- Sidd 4");
System.out.println(friends.size() + " friends:");
for (OpenSocialPerson friend : friends) {
System.out.println("- " + friend.getDisplayName());
}
System.out.println("----------");
} catch (Exception e) {
System.out.println("Request failed:" );
e.printStackTrace();
}
}
}
when i run this code i get error at line Collection<OpenSocialPerson> friends = c.fetchFriends("--------my id--------");
error is like this
Request failed:
org.opensocial.client.OpenSocialRequestException: Request returned error code: 404
at org.opensocial.client.OpenSocialBatch.getHttpResponse(Unknown Source)
at org.opensocial.client.OpenSocialBatch.submitRpc(Unknown Source)
at org.opensocial.client.OpenSocialBatch.send(Unknown Source)
at org.opensocial.client.OpenSocialClient.fetchPeople(Unknown Source)
at org.opensocial.client.OpenSocialClient.fetchPerson(Unknown Source)
at org.opensocial.client.OpenSocialClient.fetchPerson(Unknown Source)
at DisplayMyspaceFriends.main(DisplayMyspaceFriends.java:19)
Can anyone please help me out on this ?