SlideShare a Scribd company logo
A Practical Guide to
    Hypermedia APIs

Eric Oestrich
Philly.rb
2013-03-12
Eric Oestrich
          SmartLogic Solutions

http://www.smartlogicsolutions.com
@ericoestrich

github.com/oestrich
A Brief Intro to the
      Domain
NerdWord
      github.com/smartlogic/nerdword
    github.com/smartlogic/nerdword-api
github.com/smartlogic/nerdword-client-ruby
Definitely Not Scrabble
Resources
Users
 Actions:
 Register
Basic Auth
Games
Users that are playing on a shared
              board

             Actions:
              Create
               List
               View
            Play Move
Move
Set of tiles to be played at a location
Turns
Actions:
  List
 View
See It In Action
https://github.com/smartlogic/nerdword-api/
          blob/master/script/client.rb
Hypermedia Basics
Client Knows Only One
         URL
         "/"
Media Types
    HAL
Example HAL
{
    "status": "Processing",
    "_embedded": {
     "items": [
       {
         "name": "Book",
         "_links":{ "self": { "href" => "http://example.com/items/1" }
}
      }
      ]
    },
    "_links": {
      "self" => { "href" => "http://example.com/orders/1" }
    }
}
Server Side
Controllers
  Rails::Api
Models
Do not have to be ActiveRecord::Base
Resources
Should not be all of your models exported
Serializers
          Disable root
              Links
      Embedded resources
Changing serializer representations
Client Side
Basics
       Faraday
 Basic auth over SSL
Handle link traversal
Resources
     Data only
Convenience methods
       Links
Loaders
Pull down data
  Only GETs
Services
Very similar to Loaders
  Push data back up
   Perform actions
      POST, PUT
Helpful Resources
●   Creating a Hypermedia Client
     ○  http://blog.oestrich.org/2012/12/creating-a-hypermedia-
        client/
●   ActiveModel::Serializers
     ○  https://github.com/rails-api/active_model_serializers
●   Abusing ActiveModel::Serializers for HAL
     ○  http://blog.oestrich.org/2012/10/abusing-active-model-
        serializers-for-hal/
●   httpstatus.es
Useful Gems for APIs
  rspec_api_documentation
           raddocs
             letter
         json_spec
              vcr
          webmock
             cane
Questions?

http://www.smartlogicsolutions.com

http://www.twitter.com/smartlogic

http://www.github.com/smartlogic
 
http://www.facebook.com/smartlogic

More Related Content

PDF
A Practical Guide to Hypermedia APIs
SmartLogic
 
PDF
Building a spa_in_30min
Michael Hackstein
 
PDF
Oracle APEX Nitro
Marko Gorički
 
PPTX
RESTful API - Best Practices
Tricode (part of Dept)
 
PDF
Two Webs! : combining the best of Web 1.0, Web 2.0 and the Semantic Web
Danny Ayers
 
PPTX
APEX Alpe Adria 2019 - JavaScript in APEX - do it right!
Marko Gorički
 
PPTX
Building Beautiful REST APIs in ASP.NET Core
Nate Barbettini
 
PDF
Rupy2012 ArangoDB Workshop Part2
ArangoDB Database
 
A Practical Guide to Hypermedia APIs
SmartLogic
 
Building a spa_in_30min
Michael Hackstein
 
Oracle APEX Nitro
Marko Gorički
 
RESTful API - Best Practices
Tricode (part of Dept)
 
Two Webs! : combining the best of Web 1.0, Web 2.0 and the Semantic Web
Danny Ayers
 
APEX Alpe Adria 2019 - JavaScript in APEX - do it right!
Marko Gorički
 
Building Beautiful REST APIs in ASP.NET Core
Nate Barbettini
 
Rupy2012 ArangoDB Workshop Part2
ArangoDB Database
 

What's hot (20)

KEY
At Begin, URL Handling and REST
Brian Loomis
 
PDF
State of search | drupal dinner
Joris Vercammen
 
KEY
Rest
Neil Roberts
 
PPTX
RESTful API Design Best Practices Using ASP.NET Web API
💻 Spencer Schneidenbach
 
PDF
Rapid API Development ArangoDB Foxx
Michael Hackstein
 
PPSX
Speed Up Your APEX Apps with JSON and Handlebars
Marko Gorički
 
PDF
HAL APIs and Ember Data
Cory Forsyth
 
PPTX
Pragmatic REST APIs
amesar0
 
KEY
Switching search to SOLR
Phase2
 
PDF
Getting Started with Rails
Basayel Said
 
PDF
Building Beautiful REST APIs with ASP.NET Core
Stormpath
 
PDF
Building Beautiful REST APIs in ASP.NET Core
Stormpath
 
PPTX
Pragmatic REST: recent trends in API design
Marsh Gardiner
 
PDF
State of search | drupalcon dublin
Joris Vercammen
 
PPTX
Api crash
Hoang Nguyen
 
PDF
How to Contribute to Apache Usergrid
David M. Johnson
 
PDF
State of search | drupalcamp ghent
Joris Vercammen
 
PPTX
Beautiful REST and JSON APIs - Les Hazlewood
jaxconf
 
PDF
Drupal security
Jozef Toth
 
PPTX
The JSON REST API for WordPress
Taylor Lovett
 
At Begin, URL Handling and REST
Brian Loomis
 
State of search | drupal dinner
Joris Vercammen
 
RESTful API Design Best Practices Using ASP.NET Web API
💻 Spencer Schneidenbach
 
Rapid API Development ArangoDB Foxx
Michael Hackstein
 
Speed Up Your APEX Apps with JSON and Handlebars
Marko Gorički
 
HAL APIs and Ember Data
Cory Forsyth
 
Pragmatic REST APIs
amesar0
 
Switching search to SOLR
Phase2
 
Getting Started with Rails
Basayel Said
 
Building Beautiful REST APIs with ASP.NET Core
Stormpath
 
Building Beautiful REST APIs in ASP.NET Core
Stormpath
 
Pragmatic REST: recent trends in API design
Marsh Gardiner
 
State of search | drupalcon dublin
Joris Vercammen
 
Api crash
Hoang Nguyen
 
How to Contribute to Apache Usergrid
David M. Johnson
 
State of search | drupalcamp ghent
Joris Vercammen
 
Beautiful REST and JSON APIs - Les Hazlewood
jaxconf
 
Drupal security
Jozef Toth
 
The JSON REST API for WordPress
Taylor Lovett
 
Ad

Viewers also liked (7)

PDF
Introduction to Type Script by Sam Goldman, SmartLogic
SmartLogic
 
PDF
Guide to food foraging by SmartLogic's Kei Ellerbrock
SmartLogic
 
PPTX
Lean & Mean Tokyo Cabinet Recipes (with Lua) - FutureRuby '09
Ilya Grigorik
 
PDF
Serializing Value Objects-Ara Hacopian
SmartLogic
 
PPTX
Kubernetes and docker
SmartLogic
 
PDF
Wantedlyを2年間Herokuで運用した話
Yoshinori Kawasaki
 
ZIP
UXSpeakeasy - How To Get A Great UX Job
Patrick Neeman
 
Introduction to Type Script by Sam Goldman, SmartLogic
SmartLogic
 
Guide to food foraging by SmartLogic's Kei Ellerbrock
SmartLogic
 
Lean & Mean Tokyo Cabinet Recipes (with Lua) - FutureRuby '09
Ilya Grigorik
 
Serializing Value Objects-Ara Hacopian
SmartLogic
 
Kubernetes and docker
SmartLogic
 
Wantedlyを2年間Herokuで運用した話
Yoshinori Kawasaki
 
UXSpeakeasy - How To Get A Great UX Job
Patrick Neeman
 
Ad

Similar to A Practical Guide To Hypermedia APIs - Philly.rb (20)

PPTX
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Tom Johnson
 
PDF
1.6 米嘉 gobuildweb
Leo Zhou
 
PDF
Building web framework with Rack
sickill
 
KEY
Using and scaling Rack and Rack-based middleware
Alona Mekhovova
 
PDF
APIs REST Usables con Hypermedia por Javier Ramirez, para codemotion
javier ramirez
 
PPTX
Introduction to real time big data with Apache Spark
Taras Matyashovsky
 
PDF
An Introduction to Tornado
Gavin Roy
 
PDF
Cdm mil-18 - hypermedia ap is for headless platforms and data integration
David Gómez García
 
PDF
David Gómez G. - Hypermedia APIs for headless platforms and Data Integration ...
Codemotion
 
PDF
JSON REST API for WordPress
Taylor Lovett
 
ODP
Knolx session
Knoldus Inc.
 
PDF
REST easy with API Platform
Antonio Peric-Mazar
 
PPTX
REST-API introduction for developers
Patrick Savalle
 
KEY
REST teori og praksis; REST in theory and practice
hamnis
 
PPTX
Using the Cascade Server Web Service API, by Artur Tomusiak
hannonhill
 
PDF
What’s New in Rails 5.0?
Unboxed
 
PPTX
Oracle Database Management REST API
Jeff Smith
 
PPTX
SPTechCon 2014 How to develop and debug client side code in SharePoint
Mark Rackley
 
ODP
Moving from Web 1.0 to Web 2.0
Estelle Weyl
 
PPTX
API Workshop: Deep dive into REST APIs
Tom Johnson
 
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Tom Johnson
 
1.6 米嘉 gobuildweb
Leo Zhou
 
Building web framework with Rack
sickill
 
Using and scaling Rack and Rack-based middleware
Alona Mekhovova
 
APIs REST Usables con Hypermedia por Javier Ramirez, para codemotion
javier ramirez
 
Introduction to real time big data with Apache Spark
Taras Matyashovsky
 
An Introduction to Tornado
Gavin Roy
 
Cdm mil-18 - hypermedia ap is for headless platforms and data integration
David Gómez García
 
David Gómez G. - Hypermedia APIs for headless platforms and Data Integration ...
Codemotion
 
JSON REST API for WordPress
Taylor Lovett
 
Knolx session
Knoldus Inc.
 
REST easy with API Platform
Antonio Peric-Mazar
 
REST-API introduction for developers
Patrick Savalle
 
REST teori og praksis; REST in theory and practice
hamnis
 
Using the Cascade Server Web Service API, by Artur Tomusiak
hannonhill
 
What’s New in Rails 5.0?
Unboxed
 
Oracle Database Management REST API
Jeff Smith
 
SPTechCon 2014 How to develop and debug client side code in SharePoint
Mark Rackley
 
Moving from Web 1.0 to Web 2.0
Estelle Weyl
 
API Workshop: Deep dive into REST APIs
Tom Johnson
 

More from SmartLogic (20)

PDF
Writing Game Servers with Elixir
SmartLogic
 
PDF
All Aboard The Stateful Train
SmartLogic
 
PDF
DC |> Elixir Meetup - Going off the Rails into Elixir - Dan Ivovich
SmartLogic
 
PDF
Monitoring Your Elixir Application with Prometheus
SmartLogic
 
PDF
Going Multi-Node
SmartLogic
 
PDF
How SmartLogic Uses Chef-Dan Ivovich
SmartLogic
 
PPTX
A Few Interesting Things in Apple's Swift Programming Language
SmartLogic
 
PDF
Effective ActiveRecord
SmartLogic
 
PDF
An Introduction to Reactive Cocoa
SmartLogic
 
PDF
iOS Development Methodology
SmartLogic
 
PPT
CSS Preprocessors to the Rescue!
SmartLogic
 
PDF
Deploying Rails Apps with Chef and Capistrano
SmartLogic
 
PDF
From Slacker to Hacker, Practical Tips for Learning to Code
SmartLogic
 
PDF
The Language of Abstraction in Software Development
SmartLogic
 
PDF
Android Testing: An Overview
SmartLogic
 
PPTX
Intro to DTCoreText: Moving Past UIWebView | iOS Development
SmartLogic
 
PDF
Logstash: Get to know your logs
SmartLogic
 
PDF
Intro to Accounting with QuickBooks for Startups, Software Development Compan...
SmartLogic
 
PDF
Practical Chef and Capistrano for Your Rails App
SmartLogic
 
PDF
Managing complexity
SmartLogic
 
Writing Game Servers with Elixir
SmartLogic
 
All Aboard The Stateful Train
SmartLogic
 
DC |> Elixir Meetup - Going off the Rails into Elixir - Dan Ivovich
SmartLogic
 
Monitoring Your Elixir Application with Prometheus
SmartLogic
 
Going Multi-Node
SmartLogic
 
How SmartLogic Uses Chef-Dan Ivovich
SmartLogic
 
A Few Interesting Things in Apple's Swift Programming Language
SmartLogic
 
Effective ActiveRecord
SmartLogic
 
An Introduction to Reactive Cocoa
SmartLogic
 
iOS Development Methodology
SmartLogic
 
CSS Preprocessors to the Rescue!
SmartLogic
 
Deploying Rails Apps with Chef and Capistrano
SmartLogic
 
From Slacker to Hacker, Practical Tips for Learning to Code
SmartLogic
 
The Language of Abstraction in Software Development
SmartLogic
 
Android Testing: An Overview
SmartLogic
 
Intro to DTCoreText: Moving Past UIWebView | iOS Development
SmartLogic
 
Logstash: Get to know your logs
SmartLogic
 
Intro to Accounting with QuickBooks for Startups, Software Development Compan...
SmartLogic
 
Practical Chef and Capistrano for Your Rails App
SmartLogic
 
Managing complexity
SmartLogic
 

Recently uploaded (20)

PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PDF
Doc9.....................................
SofiaCollazos
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
Software Development Methodologies in 2025
KodekX
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
Doc9.....................................
SofiaCollazos
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 

A Practical Guide To Hypermedia APIs - Philly.rb