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
Everything I've Learned About APIs But Been Too...
Search
Michael Price
June 27, 2024
Programming
1
39
Everything I've Learned About APIs But Been Too Afraid To Talk About... Until Now
Slide deck from the talk on APIs I gave at Laravel Live UK 2024.
Michael Price
June 27, 2024
Tweet
Share
Other Decks in Programming
See All in Programming
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
340
Micro Frontends Unmasked Opportunities, Challenges, Alternatives
manfredsteyer
PRO
0
110
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
930
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
2k
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
340
Jakarta EE meets AI
ivargrimstad
0
670
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
890
Featured
See All Featured
Embracing the Ebb and Flow
colly
84
4.5k
Visualization
eitanlees
145
15k
We Have a Design System, Now What?
morganepeng
50
7.2k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Done Done
chrislema
181
16k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
130
Facilitating Awesome Meetings
lara
50
6.1k
Transcript
Michael Price Lead Developer, Aero Commerce
👋
Michael Price Lead Developer, Aero Commerce Integration Specialist 20+ Years
Experience 👤
Father of two Volunteer at Darlington Football Club Webmaster and
Commentator 👤
(NENDEST) NARKOOTIKUMIDEST EI TEA ME (KÜLL) MIDAGI 5MIINUST x PUULUUP
EVERYTHING I’VE LEARNED ABOUT APIS BUT BEEN TOO AFRAID TO
TALK ABOUT …UNTIL NOW.
WHAT’S THIS TALK ABOUT? • WHAT APIS ARE USED FOR
• WHAT TO DO - AND WHAT NOT TO DO • …WHETHER CREATING OR CONSUMING • BEST PRACTICES • TIPS AND TRICKS
WHAT IS AN API?
WHAT IS AN API? • APPLICATION PROGRAMMING INTERFACE • A
WAY FOR TWO APPLICATIONS TO “TALK” TO EACH OTHER • AN “APPLICATION” CAN BE SOFTWARE, SUCH AS A WEBSITE, OR MOBILE APP… • …OR HARDWARE SUCH AS A CARD TERMINAL OR SMART SPEAKER
WHAT IS AN API? • APIS EXPOSE ENDPOINTS • YOUR
APPLICATION CALLS THESE ENDPOINTS TO GET, CREATE OR UPDATE DATA
• GEOLOCATION • SEARCH • MAPS • PLACES • DIRECTIONS
GOOGLE MAPS
• LEAGUE TABLES • DIRECT DEBITS • PAYPAL • TICKETING
• CUSTOM DARLINGTON FC
• PAYMENTS • EPOS • STOCK CONTROL • ANALYTICS •
CRM AERO
• PLAYLISTS • ARTISTS • ALBUMS • TRACKS SPOTIFY
COMMON API TYPES • SOAP • SIMPLE OBJECT ACCESS PROTOCOL
• XML ONLY
COMMON API TYPES • REST • REPRESENTATIONAL STATE TRANSFER •
FLEXIBLE PAYLOADS (JSON, XML, PLAIN TEXT ETC.)
COMMON API TYPES • GRAPHQL • ORIGINALLY DEVELOPED AT FACEBOOK
• JSON ONLY
AUTHENTICATION
AUTHENTICATION • HTTP BASIC • API KEY • OAUTH •
JWT
USE THE RIGHT REQUEST METHOD
USE THE RIGHT REQUEST METHOD - retrieve a list of
resources - retrieve a speci fi c resource - create a new resource - replace a resource - update a resource - delete a resource
USE THE RIGHT HEADERS
USE THE RIGHT HEADERS • Accept AND Content-Type • USEFUL
IF AN API CAN OUTPUT MULTIPLE CONTENT TYPES
USE THE RIGHT STATUS CODES
USE THE RIGHT STATUS CODES • 200 OK • 201
Created • 202 Accepted • 204 No Content 2xx - THE GOOD ONES
USE THE RIGHT STATUS CODES • 301 Permanent Redirect •
302 Temporary Redirect • 304 Not Modified • 307 Permanent Redirect • 308 Temporary Redirect 3xx - THE INFORMATIONAL ONES
USE THE RIGHT STATUS CODES • 400 Bad Request •
401 Unauthorised • 403 Forbidden • 404 Not Found 4xx - THE CLIENT ERRORS
USE THE RIGHT STATUS CODES • 405 Method Not Allowed
• 429 Too Many Requests • 418 I’m a teapot 4xx - THE CLIENT ERRORS
USE THE RIGHT STATUS CODES • 500 Internal Server Error
• 502 Bad Gateway • 503 Service Unavailable • 504 Gateway Timeout 5xx - THE SERVER ERRORS
USE THE RIGHT STATUS CODES
USE THE RIGHT STATUS CODES
RETURNING CONTENT
RETURNING CONTENT
RESPECT RATE LIMITS
RESPECT RATE LIMITS IF YOU GET THIS… …TRY AND DO
THIS
DOCUMENTATION
DOCUMENTATION • BE THOROUGH • INCLUDE EXAMPLE PAYLOADS • INCLUDE
EXAMPLE RESPONSES • USE THE OPENAPI SPEC • CONSIDER PROVIDING AN SDK • …AND A SANDBOX / PLAYGROUND
DOCUMENTATION SWAGGER / OPENAPI Source: swagger.io
DOCUMENTATION REDOC Source: redocly.com
DOCUMENTATION STOPLIGHT Source: stoplight.io
DOCUMENTATION SLATE Source: github.com/slatedocs/slate
TESTING TOOLS
TESTING TOOLS POSTMAN Source: postman.com
TESTING TOOLS RAPIDAPI
TESTING TOOLS INSOMNIA Source: insomnia.rest
TESTING TOOLS HURL Source: hurl.dev
X: @mikkyx82 LinkedIn
[email protected]
🙂
Q+A