Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
RESTful API with Grape
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Charles Lalonde
May 20, 2016
Programming
0
220
RESTful API with Grape
Charles Lalonde
May 20, 2016
Tweet
Share
Other Decks in Programming
See All in Programming
SourceGeneratorのマーカー属性問題について
htkym
0
220
DevinとClaude Code、SREの現場で使い倒してみた件
karia
1
1.1k
2026-03-27 #terminalnight 変数展開とコマンド展開でターミナル作業をスマートにする方法
masasuzu
0
140
Symfony + NelmioApiDocBundle を使った スキーマ駆動開発 / Schema Driven Development with NelmioApiDocBundle
okashoi
0
230
ファインチューニングせずメインコンペを解く方法
pokutuna
0
170
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
190
OTP を自動で入力する裏技
megabitsenmzq
0
130
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
560
モダンOBSプラグイン開発
umireon
0
180
KagglerがMixSeekを触ってみた
morim
0
300
車輪の再発明をしよう!PHP で実装して学ぶ、Web サーバーの仕組みと HTTP の正体
h1r0
2
390
PHP 7.4でもOpenTelemetryゼロコード計装がしたい! / PHPerKaigi 2026
arthur1
1
410
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.8k
エンジニアに許された特別な時間の終わり
watany
106
240k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
330
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
75
Typedesign – Prime Four
hannesfritz
42
3k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
830
How GitHub (no longer) Works
holman
316
150k
Test your architecture with Archunit
thirion
1
2.2k
Deep Space Network (abreviated)
tonyrice
0
96
How STYLIGHT went responsive
nonsquared
100
6k
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