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
Build better API clients
Search
Boris Bügling
April 24, 2015
Programming
170
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Build better API clients
Some thoughts on building better API clients, talk given at APIDays Berlin 2015.
Boris Bügling
April 24, 2015
More Decks by Boris Bügling
See All by Boris Bügling
Testing ⌚️ Apps and Other Extensions
neonichu
1
4.7k
Cross-platform Swift
neonichu
4
18k
Building better API clients in Swift
neonichu
1
360
Cross-platform Swift
neonichu
3
960
Swift Package Manager
neonichu
2
380
Swift Package Manager
neonichu
0
86
📺
neonichu
0
2.1k
Cross-Platform Swift
neonichu
0
140
Swift Package Manager
neonichu
6
4.5k
Other Decks in Programming
See All in Programming
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
0
450
AI に Inclusive UI を書かせよう — Design Rules Skill で Compose UI を作り直す
theoriatec2024
1
460
Go × SIMDで高速化するベクトル検索 ~ルーフラインモデルでSIMDが効く境界を探れ! ~
po3rin
1
150
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
260
LLMは4年分のCompose移行を再現できるのか?実プロダクト279件のXMLで探る自動化の境界線
makun
0
440
アクセシビリティから考える情報設計
high_g_engineer
0
290
{ Android | Kotlin } Gradle Plugin in 2026
ryunen344
1
290
kubernetes コンポーネント開発入門 / 新卒N年目の勉強会&交流会!〜〇〇への誘い〜 #n_study
mazrean
0
170
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
0
240
Gmail/Google DriveをトリガーにAIエージェントを動かそう! / Run AI agents with Gmail/Google Drive as triggers!
har1101
3
470
GKE で Pod の見方を変えたら、スケールアウト時の挙動を真に捉えられた話
stkk
0
100
数年滞っていたダークモード対応をおよそ2週間で完了させる
chigichan24
0
680
Featured
See All Featured
How to make the Groovebox
asonas
2
2.4k
The agentic SEO stack - context over prompts
schlessera
0
910
sira's awesome portfolio website redesign presentation
elsirapls
0
410
For a Future-Friendly Web
brad_frost
183
10k
The Cult of Friendly URLs
andyhume
79
7k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
30 Presentation Tips
portentint
PRO
1
390
YesSQL, Process and Tooling at Scale
rocio
174
15k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
320
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
510
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
370
Transcript
BETTER API CLIENTS APIDAYS BERLIN, APRIL 2015 BORIS BÜGLING -
@NEONACHO
COCOAPODS
CONTENTFUL
None
None
None
source: http://appreviewtimes.com
Mobile apps need to be more reliable than the web.
None
Let's build better API clients to help building better apps
OPEN SOURCE
None
DOCUMENTATION
/** The server address to use for accessing any resources.
Default value: "cdn.contentful.com" */ @property (nonatomic) NSString* server; /** Configure a custom user-agent to be used in the HTTP request headers */ @property (nonatomic) NSString* userAgent;
None
COCOAPODS-DOCSTATS $ pod lib docstats 398 tokens, 100.0% documented
TESTING
let expectation = expectationWithDescription("...") waitForExpectationsWithTimeout(10) { (error) in // ...
} expectation.fulfill()
API BLUEPRINT # GET /message + Response 200 (text/plain) Hello
World!
CCLREQUESTREPLAY NSURL *blueprintURL = [[NSBundle mainBundle] URLForResource:@"fitnessfirst" withExtension:@"apib"]; CCLRequestReplayManager *replayManager
= [CCLRequestReplayManager managerFromBlueprintURL:blueprintURL error:nil]; [replayManager replay];
None
COCOAPODS-COVERAGE pod lib coverage
DISTRIBUTION
"Download the SDK from our webpage."
None
pod 'ContentfulDeliveryAPI'
COCOAPODS-PACKAGER pod package ContentfulDeliveryAPI.podspec
None
spec.dependency 'AFNetworking', '>= 2.5.2'
SO, WE'RE DONE, RIGHT?
ANTICIPATING CHANGE IS ONE OF THE CENTRAL THEMES OF REST.
Example: creating a poll
<html> <body> <h1>Poll</h1> <ul> <li><a href="/questions/new" rel="create">Make a new question</a></li>
</ul> </body> </html>
▸ Offers us to create a question ▸ We can
fill in the form we get ▸ Submit the form
We can do the same in our apps with Hypermedia
FORMATS ▸ HAL (application/hal+json) ▸ Siren (application/vnd.siren+json)
SIREN LINK { "entities": [ { "links": [ { "rel":
["self"], "href": "questions/1/choices/1" } ], "rel": ["choices"], "properties": { "choice": "Swift", "votes": 22 } } ] }
SIREN ACTION { "actions": { "create": { "href": "/questions", "method":
"POST", "fields": [ { "name": "question" }, { "name": "choices" } ], "type": "application/x-www-form-urlencoded" } } }
WE CAN NOW CHANGE IMPLEMENTATION DETAILS ON THE FLY
CHANGE URIS OF RESOURCES e.g. /polls/{id} to /questions/{id}
CHANGE HTTP METHODS e.g. PUT to POST
CHANGE THE CONTENT-TYPE
CHANGE FIELDS USED IN FORMS
REPRESENTOR
PRESENCE OF A TRANSITON if let transition = representor.transitions["create"] {
} else { // ... }
ATTRIBUTES OF A TRANSITION if let transition = representor.transitions["create"] {
transition.method transition.uri transition.suggestedContentType }
PERFORMING A TRANSITION request(transition, attributes: [ "question": "Favourite programming language?",
"choices": [ "Swift", "Ruby", "COBOL" ] ])
None
WHAT HAVE WE LEARNED? ▸ Publish source code! ▸ Document!
▸ Test! ▸ Be robust against change!
THANK YOU!
@NeoNacho
[email protected]
https://github.com/neonichu http://buegling.com/talks http://www.contentful.com