Drupal as a Web Services Platform for iPhone

By: Jingsheng Wang (skyredwang, http://insready.com/)

Some Stats:

  • 1.67 Billion Internet users. 4 Billion Mobile Phone Users. By 2013, mobile phone users with Internet access will surpass Internet users. Or earlier.
  • iPhone has the most page requests (55%), Android next (20%) then Blackberry (12%). Rest is minor.
  • Google experienced 5x more mobile search requests from 2008 to 2010
  • Simple App: 50K to 150K for a simple mobile app

How to expose Drupal APIs to external clients?

With the Drupal Services (http://drupal.org/project/services). Drupal Services adds a communication layer to your Drupal application. This module allows to output data in JSON, RPC etc.

Services Components:

  1. Servers (what should the output be?)
    1. XML-RPC
    2. JSON
    3. JSON-RPC
    4. REST
    5. AMFPHP
  2. Authentication
    1. API Keys
    2. Drupal Sessions (servers sessions can be re-used on mobile devices)
    3. OAuth
  3. Services
    1. Nodes
    2. User
    3. Taxonomy
    4. Files
    5. System
    6. Search
    7. Views Services
    8. Location
    9. Flag
    10. Any other infrastructure can be re-used (hook available for services module)


Configuration: JSON_Server + Key Auth + Session
URL: http://site.com/services/json
POST: method:system.connect
Return: sessionID

Example URL: http://drupal.org/node/339845

Framework and Platforms

iPhone (IDE: X-Code, Language: Objective-C)
Android (IDE: Eclipse, Language, Java, C, C++)
PhoneGap (Open Source platform attempting to build cross-platform mobile apps, build apps in HTML)
Appcelerator Titanium API (Presentation from DrupalCon SF)


(list taken from http://drupal.org/node/763066)

OAuth Handshake (“The future of authentication”)

Used by sites like Facebook and Flickr. 3rd-party app makes a request to grant access to data. Username and password only need sto be provided to first-party site, not 3rd-party application.