Please help with Java OAuth missing from 3.0 API

22 views
Skip to first unread message

James F

unread,
Nov 24, 2009, 5:33:25 PM11/24/09
to Google Documents List API
I am spending all my time trying to figure out how to reconstruct
various posts to add back the OAuth creditials.

What is going on? Is there some new feature?

I have posted about this in Contacts API and having problems here as
well. OAuth is critical for administrators.
http://code.google.com/p/gdata-issues/issues/detail?id=1654
where someone said: query.setStringCustomParameter
("xoauth_requestor_id", "us...@example.com");

However I can't do that with ACLs or many of the other methods

aclEntry.delete();
throws: oauth_token does not exist.

I can add a permission:
client.insert(new URL(entry.getAclFeedLink().getHref() + "/?
xoauth_requestor_id=" + account + "@" + CONSUMER_KEY),
aclEntry);

But the similar command:
client.delete(new URL(aclEntry.getEditLink().getHref()), aclEntry);
Does not exist! as in client.delete(arg0, arg1) is not in the API.

I really need to be able to update and delete.

Eric Bidelman

unread,
Nov 24, 2009, 8:04:41 PM11/24/09
to google-docum...@googlegroups.com
On Tue, Nov 24, 2009 at 5:33 PM, James F <nmag...@gmail.com> wrote:
I am spending all my time trying to figure out how to reconstruct
various posts to add back the OAuth creditials.

What is going on? Is there some new feature?

I have posted about this in Contacts API and having problems here as
well. OAuth is critical for administrators.
http://code.google.com/p/gdata-issues/issues/detail?id=1654
where someone said: query.setStringCustomParameter
("xoauth_requestor_id", "us...@example.com");

Yep, if you're using a Query object. 


However I can't do that with ACLs or many of the other methods

aclEntry.delete();
throws: oauth_token does not exist.

This won't work because the xoauth_requestor_id param
isn't appended to the URL.
 

I can add a permission:
client.insert(new URL(entry.getAclFeedLink().getHref() + "/?
xoauth_requestor_id=" + account + "@" + CONSUMER_KEY),
aclEntry);

But the similar command:
client.delete(new URL(aclEntry.getEditLink().getHref()), aclEntry);
Does not exist! as in  client.delete(arg0, arg1) is not in the API.

Can't you use...
client.delete(new URL(aclEntry.getEditLink().getHref() + 
"?xoauth_requestor_id=us...@example.com"), aclEntry.getEtag()); 

The client always has an insert/update/delete method that takes a url
and optional etag.

James F

unread,
Nov 24, 2009, 10:40:13 PM11/24/09
to Google Documents List API
No that only gives me: Invalid request URI

Eric Bidelman

unread,
Nov 25, 2009, 11:42:46 AM11/25/09
to google-docum...@googlegroups.com
Can you post the full URL you're hitting?
What library version are you using?

James F

unread,
Nov 25, 2009, 6:14:01 PM11/25/09
to Google Documents List API
Some times the answer is right there.
I split out the URL to make it easy to see.

URL aclUrl = new URL(aclentry.getEditLink().getHref()+
"?xoauth_requestor_id=" + account + "@" + CONSUMER_KEY);

client.delete(aclUrl);
or
client.delete(aclUrl, "*");

***NOT*** client.delete(aclUrl, aclEntry.getEtag());

you would normally write:
client.delete(aclentry.getEditLink().getHref()+
"?xoauth_requestor_id=" + account + "@" + CONSUMER_KEY);

I can't believe that it was that simple, why did I not read the
JavaDoc more closely?

The developer doc does says
Removing sharing permissions
Deleting a permission invovles sending a DELETE to the ACL entry's
edit link.
aclEntry.delete();
// Could also use the client's delete method
// client.delete(new URL(aclEntry.getEditLink().getHref()), aclEntry);

Apparently ACLs don't use Etags so you get an error:
com.google.gdata.util.PreconditionFailedException:
Resource does not support Etags


James F

unread,
Nov 25, 2009, 6:17:45 PM11/25/09
to Google Documents List API
BTW thank you Eric!

Eric Bidelman

unread,
Nov 30, 2009, 1:57:25 PM11/30/09
to google-docum...@googlegroups.com
Ah, ACL entries use weak ETags (those staring with W/").
Using '*' makes sense.

Cheers,
Eric

On Wed, Nov 25, 2009 at 3:17 PM, James F <nmag...@gmail.com> wrote:
BTW thank you Eric!


Reply all
Reply to author
Forward
0 new messages