Doodles for Google Apps Domain; Archive Feed Added to Google Documents List API; Apps Domain User Management with UserManager Apps Script

This week in the Google Apps Developers news, "to improve latency for users of the Google Documents List API who until now had to perform individual export operations in order to export their documents, Google now have added the "Archive Feed to the API.""Archives allow users to export a large number of items at once, […]

This week in the Google Apps Developers news, "to improve latency for users of the Google Documents List API who until now had to perform individual export operations in order to export their documents, Google now have added the "Archive Feed to the API."

"Archives allow users to export a large number of items at once, in single ZIP archives. This feature provides a useful optimization for users, greatly increasing the efficiency of export operations. Additionally, users can receive emails about archives, and choose to download them from a link provided in the email," explains Google.

For more information, please see the Archive Feed documentation.

Also, Google announced Doodles for Google Apps domain -- with this Google App users can change their company logo for selected events or holidays, just like doodles, as in the following screenshot:

doodle for google apps domain

"The Admin Settings API allows domain administrators to write scripts to programmatically change the logo of their Google Apps domain, and Google App Engine offers the ability to configure regularly scheduled tasks, so that those scripts can run automatically every day," Google informs.

Here is the Python App Engine script called doodleapps.py. Once the application is deployed on App Engine, it will run the script on a daily basis and update the logo:

import gdata.apps.adminsettings.service
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from datetime import date

class DoodleHandler(webapp.RequestHandler):
  # list of available doodles
  DOODLES = {    
    '1-1': 'images/newyearsday.jpg',
    '2-14': 'images/valentinesday.jpg',
    '10-31': 'images/halloween.jpg',
    '12-25': 'images/christmas.jpg'
  }
  
  # returns the path to the doodle corresponding to the date
  # or None if no doodle is available
  def getHolidayDoodle(self, date):
    key = '%s-%s' % (date.month, date.day)
    if key not in self.DOODLES:
      return None
      
    return self.DOODLES[key]
  
  # handles HTTP requests by setting today's doodle
  def get(self):
    doodle = self.getHolidayDoodle(date.today())
    self.response.out.write(doodle)
    
    if doodle:
      service = gdata.apps.adminsettings.service.AdminSettingsService()
      // replace domain, email and password with your credentials
      // or change the authorization mechanism to use OAuth
      service.domain = 'MYDOMAIN.COM'
      service.email = 'ADMIN@MYDOMAIN.COM'
      service.password = 'MYPASSWORD'
      service.source = 'DoodleApps'
      service.ProgrammaticLogin()
      
      # reads the doodle image and update the domain logo
      doodle_bytes = open(doodle, "rb").read()
      service.UpdateDomainLogo(doodle_bytes)

# webapp initialization
def main():
    application = webapp.WSGIApplication([('/', DoodleHandler)],
                                         debug=True)
    util.run_wsgi_app(application)


if __name__ == '__main__':
    main()

In order for the script to be deployed on App Engine, you need to to configure the application by defining a app.yaml file with the following content:

application: doodleapps
version: 1
runtime: python
api_version: 1

handlers:
- url: .*
  script: doodleapps.py

To make the script to run automatically every 24 hours, without the need for the administrator to send a request, just define another configuration file called cron.yaml:

cron:
- description: daily doodle update
  url: /
  schedule: every 24 hours

Also, note that, Google Apps Provisioning API allows developers to write user management applications in the programming language of their choice, but many system administrators prefer a script-based solution instead. To this end, Google recently launched "UserManager Apps Script" that provide Apps domain administrators an easy way to automate tasks such as batch user creation or update.

With the new Apps Script service, creating a user will be as easy as writing a single line of code:

var user = UserManager.createUser("newuser", "John", "Smith", "mypassword");

UserManager service also makes it easy to perform the same task on each account in the domain. The following sample shows how you can force all users to change their passwords at the next login:

var users = UserManager.getAllUsers();
for (var i in users) {
    users[i].setChangePasswordAtNextLogin(true);
}

Calls to the UserManager service can also be scheduled to run hourly or daily, or in response to certain events thanks to Apps Script Triggers.

To learn more what else can be done with the UserManager service, check the documentation.