Search code examples
objective-cgdata-apigoogle-docs-apigoogle-drive-api

Google Docs API fetch ACL with batch operation


I'm developing an iPhone app than uses the Google apps API.

I'm fetching all the documents in Google Docs and want to fetch the ACL for each document. I can do this by calling:

[service fetchFeedWithURL:entry.ACLFeedLink.URL completionHandler:^(GDataServiceTicket *ticket, GDataFeedBase *ACLFeed, NSError *error){            
}];

But because I want to have the ACL for each document, this will require a lot of requests. Can I do it using a batch operation instead?

I have tried the following:

GDataFeedBase *batchFeed = [[GDataFeedBase alloc] init];
NSURL *batchUrl = [[feed batchLink] URL];

GDataBatchOperation *batchOperation = [GDataBatchOperation batchOperationWithType:kGDataBatchOperationQuery];
[batchFeed setBatchOperation:batchOperation];

GDataEntryBase *entryACL = [[GDataEntryBase alloc] init];
[entryACL setIdentifier:[[[[feed entries] objectAtIndex:0] ACLFeedLink] href]];
[batchFeed addEntryWithEntry:entryACL];

[service fetchFeedWithBatchFeed:batchFeed forBatchFeedURL:batchUrl completionHandler:^(GDataServiceTicket *ticket, GDataFeedBase *feed, NSError *error){
}];

But it doenst work. I only get the actual documents and not the ACL feed.

Can anyone help me? Thanks.


Solution

  • ACL batching can only be performed for multiple ACLs on a single resource, so this will not help you.

    An approach which will be more useful for fetching ACLs would be to use the expand-acl query parameter on a GET, e.g.:

    GET https://docs.google.com/feeds/default/private/full/?v=3&expand-acl=true