The Open Social REST/RPC documentation (http://code.google.com/apis/orkut/docs/rest/developers_guide_protocol.html) says vaguely that you can play with the examples using the UNIX wget command, but I don't see it.
The problem is that the URLs have to be signed and carry proper security information. By fooling around with the example code, you can see that the OpenSocialClient class's fetchPerson() method is really just constructing a URL like the one below:
The number 083542533407771999 is my orkut user ID. You can't just "wget" this URL or put it in your browser, however. Doing so will return the error
HTTP request sent, awaiting response... 401 The request did not have a proper security token nor oauth message and unauthenticated requests are not allowed
Fooling around with the client codes (see previous post) will reveal the actual, signed URL used in the REST operation:
This URL is good for only one invocation (time-stamped).
To reproduce this, make the following change to DisplayProfileInfo.java:
and then add the following line to OpenSocialBatch.java's submitRest() method.
System.out.println("This is the post-signed REST url: " + request.getUrl().toString());
More soon. It turns out the the base OpenSocialClient.java class is actually just a wrapper around the other classes (OpenSocialRequest and so on). So although the client does not apparently support write operations, you can work around this by constructing the appropriate REST POST operation.
Subscribe to: Post Comments (Atom)
Post a Comment