unlock dependency between client teams and api team with api mock and proxy
TRANSCRIPT
![Page 1: Unlock dependency between client teams and API team with API mock and proxy](https://reader033.vdocuments.site/reader033/viewer/2022042722/58ab28ca1a28abb5278b6623/html5/thumbnails/1.jpg)
Unlock dependency between client teams and API team with API mock and proxy
Bruce Li @ascendbruce
Rails Pacific 2016 ⚡
![Page 2: Unlock dependency between client teams and API team with API mock and proxy](https://reader033.vdocuments.site/reader033/viewer/2022042722/58ab28ca1a28abb5278b6623/html5/thumbnails/2.jpg)
API Implementation Code Review Deploy QA
API Implementation Code Review Deploy QA
Web Client Implementation
Android APP Implementation
iOS App Implementation
API design
change
![Page 3: Unlock dependency between client teams and API team with API mock and proxy](https://reader033.vdocuments.site/reader033/viewer/2022042722/58ab28ca1a28abb5278b6623/html5/thumbnails/3.jpg)
![Page 4: Unlock dependency between client teams and API team with API mock and proxy](https://reader033.vdocuments.site/reader033/viewer/2022042722/58ab28ca1a28abb5278b6623/html5/thumbnails/4.jpg)
### List All Questions [GET]
+ Response 200 (application/json)
[ { "question": "Favourite programming language?", "published_at": "2014-11-11T08:40:51.620Z", "url": "/questions/1", "choices": [ { "choice": "Swift", "url": "/questions/1/choices/1", "votes": 2048 }, { "choice": "Python", "url": "/questions/1/choices/2", "votes": 1024 }, { "choice": "Objective-C", "url": "/questions/1/choices/3", "votes": 512 }, { "choice": "Ruby", "url": "/questions/1/choices/4", "votes": 256 } ] } ]
### Create a New Question [POST]
![Page 5: Unlock dependency between client teams and API team with API mock and proxy](https://reader033.vdocuments.site/reader033/viewer/2022042722/58ab28ca1a28abb5278b6623/html5/thumbnails/5.jpg)
]
### Create a New Question [POST]
You may create your own question using this action. It takes a JSON object containing a question and a collection of answers in the form of choices.
+ question (string) - The question + choices (array[string]) - A collection of choices.
+ Request (application/json)
{ "question": "Favourite programming language?", "choices": [ "Swift", "Python", "Objective-C", "Ruby" ] }
+ Response 201 (application/json)
+ Headers
Location: /questions/1
+ Body
{ "question": "Favourite programming language?", "published_at": "2014-11-11T08:40:51.620Z",
![Page 6: Unlock dependency between client teams and API team with API mock and proxy](https://reader033.vdocuments.site/reader033/viewer/2022042722/58ab28ca1a28abb5278b6623/html5/thumbnails/6.jpg)
+ Response 201 (application/json)
+ Headers
Location: /questions/1
+ Body
{ "question": "Favourite programming language?", "published_at": "2014-11-11T08:40:51.620Z", "url": "/questions/1", "choices": [ { "choice": "Swift", "url": "/questions/1/choices/1", "votes": 0 }, { "choice": "Python", "url": "/questions/1/choices/2", "votes": 0 }, { "choice": "Objective-C", "url": "/questions/1/choices/3", "votes": 0 }, { "choice": "Ruby", "url": "/questions/1/choices/4", "votes": 0 } ] }
![Page 7: Unlock dependency between client teams and API team with API mock and proxy](https://reader033.vdocuments.site/reader033/viewer/2022042722/58ab28ca1a28abb5278b6623/html5/thumbnails/7.jpg)
"choices": [ { "choice": "Swift", "url": "/questions/1/choices/1", "votes": 0 }, { "choice": "Python", "url": "/questions/1/choices/2", "votes": 0 }, { "choice": "Objective-C", "url": "/questions/1/choices/3", "votes": 0 }, { "choice": "Ruby", "url": "/questions/1/choices/4", "votes": 0 } ] }
AND 9,000+ LINES
![Page 8: Unlock dependency between client teams and API team with API mock and proxy](https://reader033.vdocuments.site/reader033/viewer/2022042722/58ab28ca1a28abb5278b6623/html5/thumbnails/8.jpg)
![Page 9: Unlock dependency between client teams and API team with API mock and proxy](https://reader033.vdocuments.site/reader033/viewer/2022042722/58ab28ca1a28abb5278b6623/html5/thumbnails/9.jpg)
specific behavior to be tested?
![Page 10: Unlock dependency between client teams and API team with API mock and proxy](https://reader033.vdocuments.site/reader033/viewer/2022042722/58ab28ca1a28abb5278b6623/html5/thumbnails/10.jpg)
DEMO
![Page 11: Unlock dependency between client teams and API team with API mock and proxy](https://reader033.vdocuments.site/reader033/viewer/2022042722/58ab28ca1a28abb5278b6623/html5/thumbnails/11.jpg)
iOS Client
API Mock
Web Client
Android Client
Sandbox
![Page 12: Unlock dependency between client teams and API team with API mock and proxy](https://reader033.vdocuments.site/reader033/viewer/2022042722/58ab28ca1a28abb5278b6623/html5/thumbnails/12.jpg)
iOS Client
API endpoint
Web Client
Android Client
Your backend
![Page 13: Unlock dependency between client teams and API team with API mock and proxy](https://reader033.vdocuments.site/reader033/viewer/2022042722/58ab28ca1a28abb5278b6623/html5/thumbnails/13.jpg)
iOS Client
API Mock
API endpoint
Web Client
Android Client
DEMO
Sandbox
Your backend
![Page 14: Unlock dependency between client teams and API team with API mock and proxy](https://reader033.vdocuments.site/reader033/viewer/2022042722/58ab28ca1a28abb5278b6623/html5/thumbnails/14.jpg)
Awesome-ize rails console in 3 steps
1. gem 'awesome_rails_console'
2. bundle install
3. rails g awesome_rails_console:install
DEMO
![Page 15: Unlock dependency between client teams and API team with API mock and proxy](https://reader033.vdocuments.site/reader033/viewer/2022042722/58ab28ca1a28abb5278b6623/html5/thumbnails/15.jpg)
@ascendbruce
toyroom.bruceli.net
Thank you
We’re hiring
Tweet me your feedback
Blog post version of this talk is coming soon