with drupal your website is an api

55
With Drupal Your Website is an API Charlie Morris User Experience Development Librarian NC State Libraries @cdmo September 29, 2014 Richmond,VA

Upload: charlie-morris

Post on 10-Jun-2015

225 views

Category:

Internet


1 download

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

Page 1: With Drupal Your Website is an API

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

September 29, 2014Richmond,VA

Page 2: With Drupal Your Website is an API

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

Page 3: With Drupal Your Website is an API

“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/

Page 4: With Drupal Your Website is an API

This presentation is about making your content future friendly.

Page 5: With Drupal Your Website is an API

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

Page 6: With Drupal Your Website is an API

Before all that, some definitions

Page 7: With Drupal Your Website is an API

1. API2. Web Service3. REST4. RESTful

Page 8: With Drupal Your Website is an API

API

Application Programming Interface

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

Zach Brand, NPR Vice President of Digital Media

Page 9: With Drupal Your Website is an API

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

Page 10: With Drupal Your Website is an API

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

Page 11: With Drupal Your Website is an API

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

Page 12: With Drupal Your Website is an API

RESTful

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

Page 13: With Drupal Your Website is an API

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

Page 14: With Drupal Your Website is an API

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

Page 15: With Drupal Your Website is an API

The Problem: Clutter(an imagined scenario)

Page 16: With Drupal Your Website is an API

To your human users your website may look like this:

Page 17: With Drupal Your Website is an API

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

Page 18: With Drupal Your Website is an API

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

Page 19: With Drupal Your Website is an API

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

Page 20: With Drupal Your Website is an API

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

Page 21: With Drupal Your Website is an API

Problems.

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

Page 22: With Drupal Your Website is an API

The Solution: Part 1, COPE

Page 23: With Drupal Your Website is an API

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

Page 24: With Drupal Your Website is an API

The Idea

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

Page 25: With Drupal Your Website is an API

The Idea

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

Page 26: With Drupal Your Website is an API

The Solution:Part 2, Content Management with Drupal

Page 27: With Drupal Your Website is an API

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

Page 28: With Drupal Your Website is an API

Structured Content

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

Page 29: With Drupal Your Website is an API

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

Page 30: With Drupal Your Website is an API

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

Page 31: With Drupal Your Website is an API

The Solution:Part 3, Drupal as a Web Service

Page 32: With Drupal Your Website is an API

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

Web Services for the People

Page 33: With Drupal Your Website is an API

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

Page 34: With Drupal Your Website is an API

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

Page 35: With Drupal Your Website is an API

Quick run-through

Page 36: With Drupal Your Website is an API
Page 37: With Drupal Your Website is an API
Page 38: With Drupal Your Website is an API
Page 39: With Drupal Your Website is an API
Page 40: With Drupal Your Website is an API
Page 41: With Drupal Your Website is an API
Page 42: With Drupal Your Website is an API

Consuming Web Service

Page 43: With Drupal Your Website is an API

NCSU Libraries Examples

● QuickSearch Typeahead● Partners iPad Web App● Hours

Page 44: With Drupal Your Website is an API

QuickSearch Typeahead results polling space data from Drupal web service

Page 45: With Drupal Your Website is an API

The James B Hunt Jr Library at NC State University

Page 46: With Drupal Your Website is an API

iPad Kiosk at the James B Hunt Jr. Library

Page 47: With Drupal Your Website is an API

iPad Kiosk Web App Screenshot

Data from Drupal web services

Page 48: With Drupal Your Website is an API

Touchscreen Kiosk

Page 49: With Drupal Your Website is an API

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

Page 50: With Drupal Your Website is an API

Eboards at D. H. Hill Library

Page 51: With Drupal Your Website is an API

Eboard Display for Hours at D. H. Hill Library

Page 52: With Drupal Your Website is an API

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

Page 53: With Drupal Your Website is an API

“The future is a RESTful Drupal”

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

Page 54: With Drupal Your Website is an API

“Every website is a software component”

Jon Udell

http://jonudell.net/OnlineComponentware.html

--->1996

Page 55: With Drupal Your Website is an API

Thank you for listening!

Any questions?

Charlie Morris@cdmoedUi 2014, Richmond, VA