Using Drupal as a backend for Android app

Post on 01-Dec-2014

167 views 3 download

Tags:

description

Drupal is one of the best content management systems on the planet that meets most of the requirements from building personal blogs to more sophisticated enterprise applications. Thousands of add-on modules and designs let you build any site you can imagine and also provide backend data services for mobile applications. Drupal’s built, used, and supported by an active and diverse community of people around the world, which makes it not only a reliable CMS but also a perfect backend platform for app development.

transcript

BarCamp Phnom Penh – 13-14 Sep 2014

Borort Sortborort@gmail.com

as a backend for Android app

So.. again, WHY Drupal?

Why use Drupal to manage Mobile app data?

• Has everything you need for content management and permissions

• Very flexible in providing a JSON REST interface

• Don’t have to write lots of server-side code from scratch

• Large Drupal community support

Configuring Drupal to be the backend for Mobile

• Install Services 3 module for Drupal to act as a REST server

• Set up an endpoint URL for the REST service

• Enable resources to expose at that endpoint

Drupal Services 3.0

• A standardized solution of integrating external applications with Drupal

• Resource oriented (CRUD = create, retrieve, update, delete, index)

• Provide web services via multiple interfaces (REST, XMLRPC, SOAP, JSON, etc.)

Service Endpoint

• [endpoint]/node.json• [endpoint]/node/1.json• [endpoint]/node.json?

parameters[nid]=1

Drupal Services Views

• Create view based resource creating Services display in a view

[endpoint]/[resource name]

[endpoint]/[resource name]?tags=1

• Execute any view via views resource call

[endpoint]/views/[view name]

[endpoint]/views/[view name]? filters[tags]=1

Why REST?

• Use standard HTTP protocol (simple data access)

• Performance (Local caching)• Multiple data formats (JSON, XML, ..)

JSON

Connecting Android to Drupal

Classes

• JSONParser (custom)• AsynTask

DEMO

Thank you!