Showing posts with label best. Show all posts
Showing posts with label best. Show all posts

Wednesday, March 11, 2015

Documents List API Best Practices Batching ACL entries

ACL (Access Control List) entries control who can access Google Docs resources. This allows more specific control over resource privacy or permissions.

Many types of applications need to grant document access for several users at once. As an example: when a new user is added to a project in the Manymoon project management application, every user on the project needs to be granted access to all attached Google docs. If there are 10 users on the project and 10 shared documents, this means the app would typically need to perform 100 HTTP requests -- a lot of overhead. With batching of ACL requests, the application can reduce the number of requests to one per document, resulting in a 10x savings.

Before Batching

A typical ACL entry for a single user is created by making an HTTP POST to the ACL link provided with each resource entry. The POST body looks something like this:

<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:gAcl=http://schemas.google.com/acl/2007>
<category scheme=http://schemas.google.com/g/2005#kind
term=http://schemas.google.com/acl/2007#accessRule/>
<gAcl:role value=writer/>
<gAcl:scope type=user value=new_writer@example.com/>
</entry>

To achieve the same thing using the Python client library, use the following code:

from gdata.acl.data import AclScope, AclRole
from gdata.docs.data import AclEntry

acl = AclEntry(
scope = AclScope(value=user@example.com, type=user),
role = AclRole(value=writer)
)

With Batching

Instead of submitting the requests separately, multiple ACL operations for a resource can be combined into a single batch request. This is done by POSTing a feed of ACL entries. Each ACL entry in the feed must have a special batch:operation element, describing the type of operation to perform on the ACL entry. Valid operations are query, insert, update, and delete.

<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:gAcl=http://schemas.google.com/acl/2007
xmlns:batch=http://schemas.google.com/gdata/batch>
<category scheme=http://schemas.google.com/g/2005#kind
term=http://schemas.google.com/acl/2007#accessRule/>
<entry>
<category scheme=http://schemas.google.com/g/2005#kind
term=http://schemas.google.com/acl/2007#accessRule/>
<gAcl:role value=reader/>
<gAcl:scope type=domain value=example.com/>
<batch:operation type=insert/>
</entry>
<entry>
<category scheme=http://schemas.google.com/g/2005#kind
term=http://schemas.google.com/acl/2007#accessRule/>
<id>https://docs.google.com/feeds/default/private/full/document%3Adocument_id/acl/user%3Aold_writer%40example.com</id>
<gAcl:role value=writer/>
<gAcl:scope type=user value=new_writer@example.com/>
<batch:operation type=update/>
</entry>
</feed>

The following code represents the same operation in the Python client library:

from gdata.data import BatchOperation
from gdata.acl.data import AclScope, AclRole
from gdata.docs.data import AclEntry

acl1 = AclEntry(
scope=AclScope(value=example.com, type=domain),
role=AclRole(value=reader),
batch_operation=BatchOperation(type=insert)
)

acl2 = client.get_acl_entry_by_self_link(
(https://docs.google.com/feeds/default/private/full/
document%3Adocument_id/acl/user%3Aold_writer%40example.com))
acl2.scope = AclScope(value=new_writer@example.com, type=user)
acl2.role = AclRole(value=writer)
acl2.batch_operation = BatchOperation(type=update)

entries = [acl1, acl2]

The feed of these entries can now be submitted together to apply to a resource:

results = client.batch_process_acl_entries(resource, entries)

The return value is an AclFeed, with a list of AclEntry elements for each operation, the status of which can be checked individually:

for result in results.entry:
print entry.title.text, entry.batch_status.code

The examples shown here are using the raw protocol or the Python client library. The Java client library also supports batch operations on ACL entries.

For more information on how to use batch operations when managing ACLs, see the Google Documents List API documentation, and the Google Data APIs batch protocol reference guide. You can also find assistance in the Google Documents List API forum.


Ali Afshar profile | twitter

Ali is a Developer Programs engineer at Google, working on Google Docs and the Shopping APIs which help shopping-based applications upload and search shopping content. As an eternal open source advocate, he contributes to a number of open source applications, and is the author of the PIDA Python IDE. Once an intensive care physician, he has a special interest in all aspects of technology for healthcare.

Read more »

Wednesday, February 18, 2015

The Top 10 Best iPhone Apps of 2013

The Top 10 Best iPhone Apps of 2013

With the ever increasing popularity of the amazing iPhone and its incredibly performing apps, 2013 has shed a new light on a wide variety of original, innovative and successfully brilliant tools. Whether you need to access your social media account on the go, need help as a student, listen to music or even find your way, there is a new app for all different types of people. In addition to their great capabilities, not only does each new iphone app provide many different beneficial options, the large majority of them also can be downloaded and used at no additional charge.

Also Read: 4 Best Tips to Clean Your Touch Screen Device
Also Read: How to Clean Laptop Parts with Simple Household Products

Instagram

The new fad in social media networking, Instagram, is one of the best new iphone apps of 2013. Combining the features of the networking giants Facebook and Twitter, this great tool is extremely fun for its users, while also having one of the best photo-taking abilities that an app has ever seen. With a filter that can make even the worst pictures look perfect, all of the photos that are posted on Instagram can be done so with some of the best artistic presentation on the internet.

Google Maps

Possible the best app for travelers is finally here with the new iPhone feature of Google Maps. Unlike using Google.com, this amazing tool not only provides you with driving directions, but it also helps map out the quickest route from point A to point B for walkers and bike riders. By entering your beginning and end destinations, this great app will provide you with the most accurate directions, while also supplying a large highlighted line to make sure that you stay on your designated course.

Netflix

Still needing a subscription for the many entertaining movies and shows that Netflix provides, this iphone app is ideal for people that do not have any other internet devices that wish to watch movies and television shows. Simply by accessing your account, all customers can now watch their favorite films or sitcoms with the ease of pushing a button.

Kindle

Amazingly, one of the best new iPhone apps is the Kindle by Amazon. Once only able to be accessed through the actual Kindle itself, the iphone now has the ability to provide its users with all of their favorite books, games and magazines that were originally produced by the Amazon tablet. Not only is this possible through the new app, the majority of the time, the Kindle can be downloaded for free.

Also Read: Top 5 Cheapest Android Tablets below Rs. 5000 in India in 2013

Yelp

Similar to Google Maps, one of the best iPhone apps of 2013 is the more than useful Yelp tool. For people that are frequently on the go, Yelp will give iPhone owners the ability to find specific types of restaurants, tourist attractions and stores. In addition, this remarkable tool also contains consumer reviews for all of the different entities that are being searched for.

Dropbox

For iPhone owners that store a lot of data on their phone, Dropbox is now available to offer additional “cloud” storage space. Allowing their users to download and upload all types of information, this great 2013 iPhone app can even be programmed to automatically store everything that is added to your device.

YouTube

Now available as an iPhone app, YouTube is the perfect tool for the individuals that wish to search for specific videos, music and other media related updates. Also at no addition charge, this video streaming instrument will allow its users to create a music playlist permitting account holders to continually listen to their favorite type of music.

GoodReader

Although there is a subscription fee, this new iPhone app is essential for today’s college student. With an unprecedented amount of PDF files that need to be accessed, GoodReader is the perfect tool for downloading specific PDF files to your phone. In addition to this crucial access, this great app will permit the creation of various files, play audio and video downloads and sync your folders to other apps like SkyDrive, Dropbox and SugarSync.

Also Read: The Top 4 Websites to Create Android Apps Online for Free

Keynote

For both business workers and students, Keynote is one of the best new iPhone apps that allow the possibility of various types of presentations. With specifically designed performance standards, this extremely helpful educational and business tool will more than exceed your presentation standards.

iTunes U

With no additional subscription charge, the iTunes U app is tremendously practical for students as it offers a wide range of college level courses from some of top American institutions like Harvard and Stanford.


About Author:
Alice McLean is a writer at bestessays.com with background in history, sociology and internet marketing. Now she is writing her first book on internet marketing.

Image Source: http://i.telegraph.co.uk/multimedia/archive/02476/iphone5_2476157b.jpg
Read more »