Google Apps APIs with PHP

Recently we were modifying Imperium to include some integration with the Google Apps APIs. Namely we wanted to use it to share contacts, provide provisioning services, modify email settings and check reports. All of these APIs are quite simple however, very inconsistent. Here’s some notes from our experience.

Google Apps Email Settings API

This API is great! Our favourite feature was being able to configure POP and IMAP rules through the API – awesome! However, the Authentication for Email API uses the ClientLogin like the others do. The necessary authentication token is in the response and can be parsed using: /^Auth=(.+)/m; Easy, and when submitting the request add an HTTP Request header that looks like:

Authorization: GoogleLogin auth=$token

The XML data that is sent to Google for this API is application/atom+xml

Google Apps Reports API

This is very similar to the Email Settings API but at the same time annoyingly inconsistent. For example, the Auth token for Reporting API is the SID! not Auth! What the hell? Disappointingly annoying but not a show stopper.

The submission of the Token is different too, not in the HTTP Request header but directly in the XML sent to Google (text/xml, not atom) like so:

>token<.....>/token<

And finally the Email Settings API uses ATOM (application/atom+xml) and the Reporting API uses some REST structure as (text/xml).

We’re not the only ones who are frustrated with this level of inconsistency and feature in-completeness with Google. Apps won’t share contacts, Apps don’t provide full-on Google Accounts, an more. Lets hope Google get’s their act together soon.

http://blog.edoceo.com/