Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
RESTful API with Grape
Search
Charles Lalonde
May 20, 2016
Programming
230
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
RESTful API with Grape
Charles Lalonde
May 20, 2016
Other Decks in Programming
See All in Programming
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
220
Event is what happens
moro
2
780
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
28
32k
気持ちぃ〜角丸 Squircle
ryu1013
0
310
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
35
17k
すこし踏み込む CancellationToken
htkym
2
1.7k
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
370
Simple Storage Service(S3) is not simple
iwatsukayura
0
290
npm との違いを手がかりにGo の依存管理を理解したい
optim
0
340
パスワード再設定メールのURLについて知っておこう
uyuki234
0
160
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
220
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
380
Featured
See All Featured
Designing Powerful Visuals for Engaging Learning
tmiket
1
610
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
820
Google's AI Overviews - The New Search
badams
0
1.6k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
530
So, you think you're a good person
axbom
PRO
2
2.2k
Scaling GitHub
holman
464
140k
Done Done
chrislema
187
17k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
620
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
400
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
Transcript
RESTful API with Grape
Hi, I’m Charles Rails Developer @ Unsplash
Unsplash Do whatever you want high-resolution photos
None
None
None
None
None
None
Why Grape?
Why Grape? • Framework to build API • Easily extensible
• Supports Rails, Sinatra and others
Setup Rails in 4 simple steps
• app/ • api/ • v1/ • base.rb Create folder
structure Setup Rails in 4 simple steps
Setup Rails in 4 simple steps Auto load the API
files in your application.rb
Mount the API in routes.rb Setup Rails in 4 simple
steps
Setup Rails in 4 simple steps • Versioning • Format
• Endpoint mounting • Default headers • Logs
{ Grape } Basic
{ Grape } Basic • Call Overview • Headers •
Parameters • Http Methods • Error Handling • Helpers
Overview • Resource • Route params • HTTP methods •
Parameters GET api.montrealrb.com/v1/:resource/:route_param
Headers • Useful for bots • Alerting users of deprecated
endpoints • Allow multiple origins • etc
Parameters • Can manage optional and required params • Multiple
parameter types • Custom validation
HTTP methods • Supports all HTTP methods • Specify endpoint
names
Error handling • Message • Status
Helpers • Create reusable code • Can include custom modules
{ Grape } gem extension
{ Grape } gem extension WineBouncer Oauth2 protection with
Doorkeeper https://github.com/antek-drzewiecki/wine_bouncer grape-rails-cache Server side cache https://github.com/monterail/grape-rails-cache grape-swagger Automatically generate documentation https://github.com/ruby-grape/grape-swagger
{ Grape } gem extension
Demo
Unsplash API Stats API Requests 230 740 265 Last 30
days API Developers 2 479 Approved Applications 184
Connect @dechuck on Twitter, GitHub & Unsplash Thanks