with drupal your website is an api

Post on 10-Jun-2015

219 Views

Category:

Internet

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

From edUi 2014 in Richmond, VA What is Drupal good for? That’s easy: Content management. Most people know that, but did you know that Drupal is also good at sharing that content? Using a couple of key modules, you can turn your Drupal-powered site into a full-fledged API or web service. By serving your content out in this manner you are freeing it! Now other applications and web pages can query against your site and pull out that content. This is highly useful for those attempting to achieve the “Create Once, Publish Everywhere” strategy so popularized by NPR. You can leverage Drupal’s content type capabilities to create authoritative, canonical editions of copy that you write and update in only one location, but that will update in any place that is consuming the content. Some examples include articles, buildings, rooms, lending devices, people, etc. Create or change the content on Drupal and the changes are seen immediately by every app and page that’s consuming the data.

TRANSCRIPT

With Drupal Your Website is an APICharlie MorrisUser Experience Development LibrarianNC State Libraries@cdmo

September 29, 2014Richmond,VA

Future Friendly

“Disruption will only accelerate. The quantity and diversity of connected devices—many of which we haven't imagined yet—will explode, as will the quantity and diversity of the people around the world who use them. Our existing standards, workflows, and infrastructure won't hold up.”

futurefriendlyweb.com

“Think of your core content as a fluid thing that gets poured into a huge number of containers. Get your content ready to go anywhere because it’s going to go everywhere”

Brad Frostbradfrostweb.com/blog/web/for-a-future-friendly-web/

This presentation is about making your content future friendly.

Agenda

1. The Problem: Clutter2. The Solution: Part 1

COPE3. The Solution: Part 2

Content Management with Drupal4. The Solution: Part 3

Drupal as Web Service5. Consuming Web Services

Before all that, some definitions

1. API2. Web Service3. REST4. RESTful

API

Application Programming Interface

“A mechanism that allows the easy transfer of data between computer systems.”

Zach Brand, NPR Vice President of Digital Media

Web Service

Usually means: an API available on the web. See also:

“Every website -- every web application -- is a service.”

-Leonard Richardson and Sam Ruby

RESTful Web Services

REST

Representational State Transfer● As opposed to “Big Web Services”

like SOAP, XML-RPC● Can leverage what HTTP can do on

its own rather than building another layer on top

● It’s pretty simple

Read more about REST

● Architectural Styles and the Design of Network-based Software Architectures, Roy Fielding, 2000

● RESTful Web Services, 2007● RESTful Web Services Cookbook,

Subbu Allamaraju, 2010

RESTful

A web service that conforms to the constraints set forth by REST.

Your website is a component of someone else’s system.

Agenda

1. The Problem: Clutter2. The Solution: Part 1

COPE3. The Solution: Part 2

Content Management with Drupal4. The Solution: Part 3

Drupal as Web Service5. Consuming Web Services

The Problem: Clutter(an imagined scenario)

To your human users your website may look like this:

Source: https://www.youtube.com/watch?v=s-CTkbHnpNQ

But to machines and content store it may look like this:

source: http://petticoatjunktion.com/my-favorite-junk-shop/a-sunny-day-at-my-favorite-junk-shop/

Might be a beautiful human-version, but...● Content is not organized into types● Content is re-created instead of re-

used (i.e., mobile, tablet, app, etc)● Little or no machine-friendly output

Problems.

● Inefficient● Redundant● Less semantic● Rigid● Probably some SEO issues● Chaotic!

The Solution: Part 1, COPE

COPE

Create Once Publish Everywhere

“A philosophy, an approach, to making sure that any time you are going to build a bit of content make damn sure you can take it everywhere, because there are more and more places you probably want to take it to.”

Zach Brand, NPR Vice President of Digital MediaSXSW 2011

The Idea

● Create one thing● Edit in one place● Display that one content anywhere

The Idea

● Create one thing● Edit in one place● Display that one content anywhere● No redundant work● Get the most of a CMS

The Solution:Part 2, Content Management with Drupal

What Drupal can do

● Organize content by type● Create custom fields for custom

types● Attach ownership to content● Advanced query system for

complex display (see Views)● Ability to relate content to content● Abstract content from display

Structured Content

example:Spaces● Title● Description● Room Number● Building● Photo● etc.

Massive Community

● “1,113,592 people in 230 countries* speaking 181 languages power Drupal.”

● 43k Questions, 55k Answers on Drupal Answers (Stack Exchange subsite, another 15k tagged on SE)

● at least 298 libraries of all stripes

source drupal.org, stackexchange.com/sites, groups.drupal.org/libraries/libraries

Extendable

“Drupal is to content management systems what Python is to code. You can chuck what you want in it, at it or pass things through it and it will work reliably to produce what you want back.”

-Dries Buyaertbuytaert.net/focusing-on-all-drupal-competitors, 2011

The Solution:Part 3, Drupal as a Web Service

source https://flic.kr/p/5nCcXa

Web Services for the People

Services Module

● Turn your content into machine-friendly RESTful web services with a click of the mouse!

● See drupal.org/project/services ● Many output options● GET and POST● Can use Views to create service too

Install via admin interface or use drush[go to web root]

drush dl drupal

mv drupal-7.31 edui2014

cd edui2014

[create database/user in MySQL]

[take care of /sites/default]

drush en services services_views views_ui rest_server -y

Quick run-through

Consuming Web Service

NCSU Libraries Examples

● QuickSearch Typeahead● Partners iPad Web App● Hours

QuickSearch Typeahead results polling space data from Drupal web service

The James B Hunt Jr Library at NC State University

iPad Kiosk at the James B Hunt Jr. Library

iPad Kiosk Web App Screenshot

Data from Drupal web services

Touchscreen Kiosk

Touchscreen Kiosk Hours Tab at D. H. Hill Library at NCSU

Eboards at D. H. Hill Library

Eboard Display for Hours at D. H. Hill Library

Solid Tutorial

See “Drupal & PhoneGap - Mobile Application with Drupal 7 Services, PhoneGap & JQuery Mobile for Android - Example” from Tyler Frankenstein, 2011

tylerfrankenstein.com/code/android-app-with-drupal-7-services-phonegap-and-jquery-mobile

“The future is a RESTful Drupal”

source: buytaert.net/the-future-is-a-restful-drupal

“Every website is a software component”

Jon Udell

http://jonudell.net/OnlineComponentware.html

--->1996

Thank you for listening!

Any questions?

Charlie Morris@cdmoedUi 2014, Richmond, VA

top related