A Practical Guide To Hypermedia APIs - Philly.rb
Upcoming SlideShare
Loading in...5
×
 

A Practical Guide To Hypermedia APIs - Philly.rb

on

  • 1,157 views

 

Statistics

Views

Total Views
1,157
Views on SlideShare
1,154
Embed Views
3

Actions

Likes
0
Downloads
2
Comments
0

1 Embed 3

https://twitter.com 3

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-NonCommercial LicenseCC Attribution-NonCommercial License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    A Practical Guide To Hypermedia APIs - Philly.rb A Practical Guide To Hypermedia APIs - Philly.rb Presentation Transcript

    • A Practical Guide to Hypermedia APIsEric OestrichPhilly.rb2013-03-12
    • Eric Oestrich SmartLogic Solutionshttp://www.smartlogicsolutions.com@ericoestrichgithub.com/oestrich
    • A Brief Intro to the Domain
    • NerdWord github.com/smartlogic/nerdword github.com/smartlogic/nerdword-apigithub.com/smartlogic/nerdword-client-ruby
    • Definitely Not Scrabble
    • Resources
    • Users Actions: RegisterBasic Auth
    • GamesUsers that are playing on a shared board Actions: Create List View Play Move
    • MoveSet of tiles to be played at a location
    • TurnsActions: List View
    • See It In Actionhttps://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
    • ModelsDo not have to be ActiveRecord::Base
    • ResourcesShould not be all of your models exported
    • Serializers Disable root Links Embedded resourcesChanging serializer representations
    • Client Side
    • Basics Faraday Basic auth over SSLHandle link traversal
    • Resources Data onlyConvenience methods Links
    • LoadersPull down data Only GETs
    • ServicesVery 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.comhttp://www.twitter.com/smartlogichttp://www.github.com/smartlogic http://www.facebook.com/smartlogic