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:
http://sandbox.orkut.com/social/rest/people/08354253340777199997/@self
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:
http://sandbox.orkut.com/social/rest/people/08354253340777199
997/@self?oauth_consumer_key=orkut.com%3A623061448914&oauth_nonce=1231537930162003000&oauth_tim
estamp=1231537930&oauth_signature=0h%2FU49KtBplnmnc%2BhDKsDxFPR9k%3D&oauth_signature_method=HMA
C-SHA1&oauth_token=&xoauth_requestor_id=03067092798963641994&oauth_version=1.0
This URL is good for only one invocation (time-stamped).
To reproduce this, make the following change to DisplayProfileInfo.java:
// c.setProperty(OpenSocialClient.Properties.RPC_ENDPOINT,
// "http://sandbox.orkut.com/social/rpc");
c.setProperty(OpenSocialClient.Properties.REST_BASE_URI,
"http://sandbox.orkut.com/social/rest");
and then add the following line to OpenSocialBatch.java's submitRest() method.
OpenSocialRequestSigner.signRequest(request, client);
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)
No comments:
Post a Comment