SlideShare a Scribd company logo
A P I P A I N - P O I N T S
G E T T I N G T H I N G S W R O N G F O R F U N A N D P R O F I T
@ P H I L S T U R G E O N 2 0 1 4
A R C H I T E C T U R E
O L D S C H O O L
http://girlsgotsole.com/blog/thankful-thursday-rest-days/
D A T A B A S E S E E D I N G
L E A V E Y O U R C U S T O M E R S A L O N E
E N D P O I N T T H E O R Y
N A M I N G T H I N G S I S H A R D
P L U R A L V S I N G U L A R ?
C O N S I S T E N C Y I S K I N G
/user/23
/users
P L U R A L V S I N G U L A R ?
C O N S I S T E N C Y I S K I N G
/opportunity/43
/opportunities
P L U R A L V S I N G U L A R ?
C O N S I S T E N C Y I S K I N G
/person/dave
/people
P L U R A L V S I N G U L A R ?
C O N S I S T E N C Y I S K I N G
/places
/places/12
/places/12/checkins
/places/12/checkins/34
/checkins/34
N O N E E D F O R S E O
Q U E R Y S T R I N G S A R E F I N E
/users/active/true
/users?active=true
A U T O - I N C R E M E N T = B A D
C T R L + S Y O U R W E B S I T E
/checkins/1
/checkins/2
/checkins/2369
…
/checkins/3
A U T O - I N C R E M E N T = B A D
C T R L + S Y O U R W E B S I T E
github.com/zackkitzmiller/tiny-php
$tiny = new ZackKitzmillerTiny('lDpuU74QNH6B');
echo $tiny->to(5);
// E
echo $tiny->from('E');
// 5
A U T O - I N C R E M E N T = B A D
C T R L + S Y O U R W E B S I T E
use RhumsaaUuidUuid;
use RhumsaaUuidExceptio
$uuid4 = Uuid::uuid4();
echo $uuid4;
// 25769c6c-d34d-4bfe-ba98-e0ee856f3e7a
github.com/ramsey/uuid
H T T P V E R B S M A T T E R
H O N E S T L Y
Dont be @jamiehannaford.
That sounds like a bad day.
F O R M P A Y L O A D S
J U S T S E N D J S O N
foo=something&bar[baz]=thing
&bar[stuff]=junk&bar=true18
H A C K Y P A Y L O A D S
N O T L I K E T H A T
R E A L J S O N P A Y L O A D S
T H N X !
R E A D I N G R E A L D A T A I S
E A S Y
T H E H T T P W A Y
json_decode($_POST['stupid-json']);
json_decode(file_get_contents(‘php://input'));
Input::get(‘foo’);
2 0 0 I S N O T T H E O N L Y
S U C C E S S
K N O W Y O U R C O D E S
if ($statusCode != 200) {
throw new Exception('AAGHH!!');
}
2xx is all about success
3xx is all about redirection
4xx is all about client errors
5xx is all about service errors
200 - Generic everything is OK
201 - Created something OK
202 - Accepted but is being processed async
400 - Bad Request (Validation?)
401 - Unauthorized
403 - Current user is forbidden
404 - That URL is not a valid route
405 - Method Not Allowed
410 - Data has been deleted, deactivated, suspended, etc
500 - Something unexpected happened and it is the APIs fault
503 - API is not here right now, please try again later
418 - I am a Teapot
http://httpstatus.es/418
C L E A R , H U M A N
E R R O R S
W H A T H A P P E N E D
{
"error": {
"errors": [
{
"domain": "youtube.parameter",
"reason": "missingRequiredParameter",
"message": "No filter selected.",
"locationType": "parameter",
"location": ""
}
],
"code": 400,
"message": "No filter selected."
}
}
E R R O R S S H O U L D M A K E
S E N S E
W H A T H A P P E N E D
&mine=true
"reason": "missingRequiredParameter",
"message": "No filter selected.",
…
WTF
S U P P L E M E N T H T T P
C O D E S
W H A T H A P P E N E D
{
"error": {
"type": "OAuthException",
"message": "Session has expired at unix time 138
}
}
S U P P L E M E N T H T T P
C O D E S
W H A T H A P P E N E D
{
"error": {
"message": "(#210) Subject must be a page.",
"type": "OAuthException",
"code": 210
}
}
S U P P L E M E N T H T T P
C O D E S
W H A T H A P P E N E D
{
"error": {
"message": "(#210) Subject must be a page.",
"type": "OAuthException",
"code": 210,
"url": “http://developers.facebook.com/errors#210“
}
}
O A U T H 2 . 0
thephpleague.com
github.com/thephpleague/oauth2-server
O A U T H 2 C A N D O A L O T
P A S S W O R D S , I M P L I C I T , S O C I A L L O G I N S …
U S E S S L
L O L
E X C E P T F O R …
F A C E B O O K … Y O U
B # % @ * D S ! ! !
S E R I O U S L Y
Refresh Tokens?
Lol
Y O U T U B E … Y O U S E M I -
B # % @ * D S ! ! !
S T I L L S E R I O U S L Y
Refresh Tokens?
Kinda
P R E S E N T A T I O N L A Y E R
D O N T L E T U S E R S B E H I N D T H E C U R T A I N
return Places::all();
P R E S E N T A T I O N L A Y E R
D O N T L E T U S E R S B E H I N D T H E C U R T A I N
T R A N S F O R M E R S …
A S S E M B L E !
public function transform(Book $book)
{
return [
'id' => (int) $book->id,
'title' => $book->title,
'year' => $book->yr,
‘created' => (string) $book->created_at,
];
}
fractal.thephpleague.com
F L E X I B L E R E S P O N S E S
S T O P Y O U R I P H O N E D E V C O M P L A I N I N G
GET /checkins/dsfXte
?include=place,user,activity
P A G I N A T E
D A T A G R O W S F A S T
{
"data": [
...
],
"cursors": {
"after": "MTI=",
"next_url": "https://api.example.com/places
?cursor=MTI%3"
}
}
D E F I N E A L I M I T R A N G E
P A G I N A T I O N D D O S
if ($limit < 1 || $limit > 100) {
$limit = 100;
}
A U T O M A T E T E S T I N G
I F Y O U L O V E Y O U R J O B
http://www.engineersgotblued.com/
P H P U N I T + B E H A T
http://www.bil-jac.com/bestfriendsclub.php
Scenario: Find a merchant
When I request "GET /moments/1"
Then I get a "200" response
And scope into the "data" property
And the properties exist:
"""
id
title
year
created
"""
Scenario: Try to find an ` checkin
When I request "GET /checkins/nope"
Then I get a "404" response
Scenario:Wrong Arguments for user follow
Given I have the payload:
"""
{"is_following": "foo"}
"""
When I request "PUT /users/1”
Then I get a "400" response
Not a boolean
apiblueprint.org
V E R S I O N I N G
/ V 1 / D O E S N T C O U N T
https://api.example.com/v1/places
V E R S I O N I N G
/ V 1 / D O E S N T C O U N T
https://api-v1.example.com/places
V E R S I O N I N G
/ V 1 / D O E S N T C O U N T
Accept: application/vnd.example+json; version=1
Accept: application/vnd.example+json; version=2
V E R S I O N I N G
/ V 1 / D O E S N T C O U N T
Accept: application/vnd.example.user+json; version=1
Accept: application/vnd.example.user+json; version=2
V E R S I O N I N G
/ V 1 / D O E S N T C O U N T
Copy Facebook
Maybe?
THIS ONE TIME!
Facebook ruined the one good thing they ever did
E V E R Y T H I N G I S
W R O N G
D O N T B E T H A T G U Y
troyhunt.com/2014/02/your-api-versioning-is-wrong-which-is.html
leanpub.com/build-apis-you-wont-hate/c/TOONARMY

More Related Content

What's hot

Web Development with CoffeeScript and Sass
Web Development with CoffeeScript and SassWeb Development with CoffeeScript and Sass
Web Development with CoffeeScript and Sass
Brian Hogan
 
PHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vulnPHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vuln
Sandro Zaccarini
 
wreewrer
wreewrerwreewrer
wreewrer
JohnHotyn
 
Php web backdoor obfuscation
Php web backdoor obfuscationPhp web backdoor obfuscation
Php web backdoor obfuscation
Sandro Zaccarini
 
Concept History
Concept HistoryConcept History
Concept Historyjonphipps
 
Twas the night before Malware...
Twas the night before Malware...Twas the night before Malware...
Twas the night before Malware...
DoktorMandrake
 
H4x0rs gonna hack
H4x0rs gonna hackH4x0rs gonna hack
H4x0rs gonna hack
Xchym Hiệp
 
Rooted 2010 ppp
Rooted 2010 pppRooted 2010 ppp
Rooted 2010 ppp
noc_313
 
Code obfuscation, php shells & more
Code obfuscation, php shells & moreCode obfuscation, php shells & more
Code obfuscation, php shells & more
Mattias Geniar
 
SULTHAN's - PHP MySQL programs
SULTHAN's - PHP MySQL programsSULTHAN's - PHP MySQL programs
SULTHAN's - PHP MySQL programs
SULTHAN BASHA
 
SmartData Webinar Slides JSON-LD
SmartData Webinar Slides JSON-LD SmartData Webinar Slides JSON-LD
SmartData Webinar Slides JSON-LD
DATAVERSITY
 
Diary of a Hack
Diary of a HackDiary of a Hack
Diary of a Hack
Helmut Hummel
 
Yql && Raphaël
Yql && RaphaëlYql && Raphaël
Yql && Raphaël
Lachlan Hardy
 
Building Things Fast - and getting approval
Building Things Fast - and getting approvalBuilding Things Fast - and getting approval
Building Things Fast - and getting approvalSimon Willison
 
Hebrew Bible as Data: Laboratory, Sharing, Lessons
Hebrew Bible as Data: Laboratory, Sharing, LessonsHebrew Bible as Data: Laboratory, Sharing, Lessons
Hebrew Bible as Data: Laboratory, Sharing, Lessons
Dirk Roorda
 
Easy logins for Ruby web applications
Easy logins for Ruby web applicationsEasy logins for Ruby web applications
Easy logins for Ruby web applications
Francois Marier
 
Unix shell scripting basics
Unix shell scripting basicsUnix shell scripting basics
Unix shell scripting basicsAbhay Sapru
 
Tasc workshop presentation
Tasc workshop presentationTasc workshop presentation
Tasc workshop presentationvalleraj
 
YQL - Christian Heilmann Open Hack London presentation
YQL - Christian Heilmann Open Hack London presentationYQL - Christian Heilmann Open Hack London presentation
YQL - Christian Heilmann Open Hack London presentation
Korben00
 
Yahoo is open to developers
Yahoo is open to developersYahoo is open to developers
Yahoo is open to developers
Christian Heilmann
 

What's hot (20)

Web Development with CoffeeScript and Sass
Web Development with CoffeeScript and SassWeb Development with CoffeeScript and Sass
Web Development with CoffeeScript and Sass
 
PHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vulnPHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vuln
 
wreewrer
wreewrerwreewrer
wreewrer
 
Php web backdoor obfuscation
Php web backdoor obfuscationPhp web backdoor obfuscation
Php web backdoor obfuscation
 
Concept History
Concept HistoryConcept History
Concept History
 
Twas the night before Malware...
Twas the night before Malware...Twas the night before Malware...
Twas the night before Malware...
 
H4x0rs gonna hack
H4x0rs gonna hackH4x0rs gonna hack
H4x0rs gonna hack
 
Rooted 2010 ppp
Rooted 2010 pppRooted 2010 ppp
Rooted 2010 ppp
 
Code obfuscation, php shells & more
Code obfuscation, php shells & moreCode obfuscation, php shells & more
Code obfuscation, php shells & more
 
SULTHAN's - PHP MySQL programs
SULTHAN's - PHP MySQL programsSULTHAN's - PHP MySQL programs
SULTHAN's - PHP MySQL programs
 
SmartData Webinar Slides JSON-LD
SmartData Webinar Slides JSON-LD SmartData Webinar Slides JSON-LD
SmartData Webinar Slides JSON-LD
 
Diary of a Hack
Diary of a HackDiary of a Hack
Diary of a Hack
 
Yql && Raphaël
Yql && RaphaëlYql && Raphaël
Yql && Raphaël
 
Building Things Fast - and getting approval
Building Things Fast - and getting approvalBuilding Things Fast - and getting approval
Building Things Fast - and getting approval
 
Hebrew Bible as Data: Laboratory, Sharing, Lessons
Hebrew Bible as Data: Laboratory, Sharing, LessonsHebrew Bible as Data: Laboratory, Sharing, Lessons
Hebrew Bible as Data: Laboratory, Sharing, Lessons
 
Easy logins for Ruby web applications
Easy logins for Ruby web applicationsEasy logins for Ruby web applications
Easy logins for Ruby web applications
 
Unix shell scripting basics
Unix shell scripting basicsUnix shell scripting basics
Unix shell scripting basics
 
Tasc workshop presentation
Tasc workshop presentationTasc workshop presentation
Tasc workshop presentation
 
YQL - Christian Heilmann Open Hack London presentation
YQL - Christian Heilmann Open Hack London presentationYQL - Christian Heilmann Open Hack London presentation
YQL - Christian Heilmann Open Hack London presentation
 
Yahoo is open to developers
Yahoo is open to developersYahoo is open to developers
Yahoo is open to developers
 

Similar to API Pain Points (PHPNE)

GraphQL, l'avenir du REST ?
GraphQL, l'avenir du REST ?GraphQL, l'avenir du REST ?
GraphQL, l'avenir du REST ?
Francois Zaninotto
 
php[world] 2016 - You Don’t Need Node.js - Async Programming in PHP
php[world] 2016 - You Don’t Need Node.js - Async Programming in PHPphp[world] 2016 - You Don’t Need Node.js - Async Programming in PHP
php[world] 2016 - You Don’t Need Node.js - Async Programming in PHP
Adam Englander
 
Representing Material Culture Online: Historic Clothing in Omeka
Representing Material Culture Online: Historic Clothing in OmekaRepresenting Material Culture Online: Historic Clothing in Omeka
Representing Material Culture Online: Historic Clothing in Omeka
Arden Kirkland
 
2014 06-23 velocity sc beyond page metrics
2014 06-23 velocity sc beyond page metrics2014 06-23 velocity sc beyond page metrics
2014 06-23 velocity sc beyond page metricsBuddy Brewer
 
iOS 개발자의 Flutter 체험기
iOS 개발자의 Flutter 체험기iOS 개발자의 Flutter 체험기
iOS 개발자의 Flutter 체험기
Wanbok Choi
 
Meteor WWNRW Intro
Meteor WWNRW IntroMeteor WWNRW Intro
Meteor WWNRW Intro
Stephan Hochhaus
 
PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!
Blanca Mancilla
 
Zend con 2016 - Asynchronous Prorgamming in PHP
Zend con 2016 - Asynchronous Prorgamming in PHPZend con 2016 - Asynchronous Prorgamming in PHP
Zend con 2016 - Asynchronous Prorgamming in PHP
Adam Englander
 
Google Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różnice
Google Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różniceGoogle Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różnice
Google Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różnice
Artur Skowroński
 
Fast api
Fast apiFast api
Fast api
Simone Di Maulo
 
Reduce, Reuse, Refactor
Reduce, Reuse, RefactorReduce, Reuse, Refactor
Reduce, Reuse, Refactor
cklosowski
 
No Flex Zone: Empathy Driven Development
No Flex Zone: Empathy Driven DevelopmentNo Flex Zone: Empathy Driven Development
No Flex Zone: Empathy Driven Development
Duretti H.
 
Exploring the Sweet Spot: Geolocation, Health, and Gov-data
Exploring the Sweet Spot: Geolocation, Health, and Gov-data Exploring the Sweet Spot: Geolocation, Health, and Gov-data
Exploring the Sweet Spot: Geolocation, Health, and Gov-data
Lance Roggendorff
 
InterCon 2016 - Internet of “Thinking” – IoT sem BS com ESP8266
InterCon 2016 - Internet of “Thinking” – IoT sem BS com ESP8266InterCon 2016 - Internet of “Thinking” – IoT sem BS com ESP8266
InterCon 2016 - Internet of “Thinking” – IoT sem BS com ESP8266
iMasters
 
InterCon 2016 - Blockchain e smart-contracts em Ethereu
InterCon 2016 - Blockchain e smart-contracts em EthereuInterCon 2016 - Blockchain e smart-contracts em Ethereu
InterCon 2016 - Blockchain e smart-contracts em Ethereu
iMasters
 
Semantic SEO in the post Hummingbird Era and WordLift
Semantic SEO in the post Hummingbird Era and WordLiftSemantic SEO in the post Hummingbird Era and WordLift
Semantic SEO in the post Hummingbird Era and WordLift
Andrea Volpini
 
Yes, you can git!
Yes, you can git!Yes, you can git!
Yes, you can git!
Carol Willing
 
Api pain points
Api pain pointsApi pain points
Api pain points
Phil Sturgeon
 
WordPress in 30 minutes
WordPress in 30 minutesWordPress in 30 minutes
WordPress in 30 minutes
Owen Winkler
 
Profiling Web Archives IIPC GA 2015
Profiling Web Archives IIPC GA 2015Profiling Web Archives IIPC GA 2015
Profiling Web Archives IIPC GA 2015
Sawood Alam
 

Similar to API Pain Points (PHPNE) (20)

GraphQL, l'avenir du REST ?
GraphQL, l'avenir du REST ?GraphQL, l'avenir du REST ?
GraphQL, l'avenir du REST ?
 
php[world] 2016 - You Don’t Need Node.js - Async Programming in PHP
php[world] 2016 - You Don’t Need Node.js - Async Programming in PHPphp[world] 2016 - You Don’t Need Node.js - Async Programming in PHP
php[world] 2016 - You Don’t Need Node.js - Async Programming in PHP
 
Representing Material Culture Online: Historic Clothing in Omeka
Representing Material Culture Online: Historic Clothing in OmekaRepresenting Material Culture Online: Historic Clothing in Omeka
Representing Material Culture Online: Historic Clothing in Omeka
 
2014 06-23 velocity sc beyond page metrics
2014 06-23 velocity sc beyond page metrics2014 06-23 velocity sc beyond page metrics
2014 06-23 velocity sc beyond page metrics
 
iOS 개발자의 Flutter 체험기
iOS 개발자의 Flutter 체험기iOS 개발자의 Flutter 체험기
iOS 개발자의 Flutter 체험기
 
Meteor WWNRW Intro
Meteor WWNRW IntroMeteor WWNRW Intro
Meteor WWNRW Intro
 
PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!
 
Zend con 2016 - Asynchronous Prorgamming in PHP
Zend con 2016 - Asynchronous Prorgamming in PHPZend con 2016 - Asynchronous Prorgamming in PHP
Zend con 2016 - Asynchronous Prorgamming in PHP
 
Google Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różnice
Google Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różniceGoogle Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różnice
Google Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różnice
 
Fast api
Fast apiFast api
Fast api
 
Reduce, Reuse, Refactor
Reduce, Reuse, RefactorReduce, Reuse, Refactor
Reduce, Reuse, Refactor
 
No Flex Zone: Empathy Driven Development
No Flex Zone: Empathy Driven DevelopmentNo Flex Zone: Empathy Driven Development
No Flex Zone: Empathy Driven Development
 
Exploring the Sweet Spot: Geolocation, Health, and Gov-data
Exploring the Sweet Spot: Geolocation, Health, and Gov-data Exploring the Sweet Spot: Geolocation, Health, and Gov-data
Exploring the Sweet Spot: Geolocation, Health, and Gov-data
 
InterCon 2016 - Internet of “Thinking” – IoT sem BS com ESP8266
InterCon 2016 - Internet of “Thinking” – IoT sem BS com ESP8266InterCon 2016 - Internet of “Thinking” – IoT sem BS com ESP8266
InterCon 2016 - Internet of “Thinking” – IoT sem BS com ESP8266
 
InterCon 2016 - Blockchain e smart-contracts em Ethereu
InterCon 2016 - Blockchain e smart-contracts em EthereuInterCon 2016 - Blockchain e smart-contracts em Ethereu
InterCon 2016 - Blockchain e smart-contracts em Ethereu
 
Semantic SEO in the post Hummingbird Era and WordLift
Semantic SEO in the post Hummingbird Era and WordLiftSemantic SEO in the post Hummingbird Era and WordLift
Semantic SEO in the post Hummingbird Era and WordLift
 
Yes, you can git!
Yes, you can git!Yes, you can git!
Yes, you can git!
 
Api pain points
Api pain pointsApi pain points
Api pain points
 
WordPress in 30 minutes
WordPress in 30 minutesWordPress in 30 minutes
WordPress in 30 minutes
 
Profiling Web Archives IIPC GA 2015
Profiling Web Archives IIPC GA 2015Profiling Web Archives IIPC GA 2015
Profiling Web Archives IIPC GA 2015
 

More from Phil Sturgeon

PHP-FIG: Past, Present and Future
PHP-FIG: Past, Present and FuturePHP-FIG: Past, Present and Future
PHP-FIG: Past, Present and Future
Phil Sturgeon
 
Become Master of Your Own Universe - DIBI 2013
Become Master of Your Own Universe - DIBI 2013Become Master of Your Own Universe - DIBI 2013
Become Master of Your Own Universe - DIBI 2013
Phil Sturgeon
 
Laravel and Composer
Laravel and ComposerLaravel and Composer
Laravel and Composer
Phil Sturgeon
 
Why I &lt;3 Laravel 4
Why I &lt;3 Laravel 4Why I &lt;3 Laravel 4
Why I &lt;3 Laravel 4Phil Sturgeon
 
Introduction to Fuel
Introduction to FuelIntroduction to Fuel
Introduction to FuelPhil Sturgeon
 
Running an Open-Source CodeIgniter project
Running an Open-Source CodeIgniter projectRunning an Open-Source CodeIgniter project
Running an Open-Source CodeIgniter projectPhil Sturgeon
 

More from Phil Sturgeon (8)

PHP-FIG: Past, Present and Future
PHP-FIG: Past, Present and FuturePHP-FIG: Past, Present and Future
PHP-FIG: Past, Present and Future
 
Become Master of Your Own Universe - DIBI 2013
Become Master of Your Own Universe - DIBI 2013Become Master of Your Own Universe - DIBI 2013
Become Master of Your Own Universe - DIBI 2013
 
Laravel and Composer
Laravel and ComposerLaravel and Composer
Laravel and Composer
 
Why I &lt;3 Laravel 4
Why I &lt;3 Laravel 4Why I &lt;3 Laravel 4
Why I &lt;3 Laravel 4
 
CodeIgniter 3.0
CodeIgniter 3.0CodeIgniter 3.0
CodeIgniter 3.0
 
Cms expo
Cms expoCms expo
Cms expo
 
Introduction to Fuel
Introduction to FuelIntroduction to Fuel
Introduction to Fuel
 
Running an Open-Source CodeIgniter project
Running an Open-Source CodeIgniter projectRunning an Open-Source CodeIgniter project
Running an Open-Source CodeIgniter project
 

Recently uploaded

Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 

Recently uploaded (20)

Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 

API Pain Points (PHPNE)

  • 1. A P I P A I N - P O I N T S G E T T I N G T H I N G S W R O N G F O R F U N A N D P R O F I T @ P H I L S T U R G E O N 2 0 1 4
  • 2.
  • 3.
  • 4. A R C H I T E C T U R E O L D S C H O O L
  • 5.
  • 7. D A T A B A S E S E E D I N G L E A V E Y O U R C U S T O M E R S A L O N E
  • 8. E N D P O I N T T H E O R Y N A M I N G T H I N G S I S H A R D
  • 9. P L U R A L V S I N G U L A R ? C O N S I S T E N C Y I S K I N G /user/23 /users
  • 10. P L U R A L V S I N G U L A R ? C O N S I S T E N C Y I S K I N G /opportunity/43 /opportunities
  • 11. P L U R A L V S I N G U L A R ? C O N S I S T E N C Y I S K I N G /person/dave /people
  • 12. P L U R A L V S I N G U L A R ? C O N S I S T E N C Y I S K I N G /places /places/12 /places/12/checkins /places/12/checkins/34 /checkins/34
  • 13. N O N E E D F O R S E O Q U E R Y S T R I N G S A R E F I N E /users/active/true /users?active=true
  • 14. A U T O - I N C R E M E N T = B A D C T R L + S Y O U R W E B S I T E /checkins/1 /checkins/2 /checkins/2369 … /checkins/3
  • 15. A U T O - I N C R E M E N T = B A D C T R L + S Y O U R W E B S I T E github.com/zackkitzmiller/tiny-php $tiny = new ZackKitzmillerTiny('lDpuU74QNH6B'); echo $tiny->to(5); // E echo $tiny->from('E'); // 5
  • 16. A U T O - I N C R E M E N T = B A D C T R L + S Y O U R W E B S I T E use RhumsaaUuidUuid; use RhumsaaUuidExceptio $uuid4 = Uuid::uuid4(); echo $uuid4; // 25769c6c-d34d-4bfe-ba98-e0ee856f3e7a github.com/ramsey/uuid
  • 17. H T T P V E R B S M A T T E R H O N E S T L Y Dont be @jamiehannaford. That sounds like a bad day.
  • 18. F O R M P A Y L O A D S J U S T S E N D J S O N foo=something&bar[baz]=thing &bar[stuff]=junk&bar=true18
  • 19. H A C K Y P A Y L O A D S N O T L I K E T H A T
  • 20. R E A L J S O N P A Y L O A D S T H N X !
  • 21. R E A D I N G R E A L D A T A I S E A S Y T H E H T T P W A Y json_decode($_POST['stupid-json']); json_decode(file_get_contents(‘php://input')); Input::get(‘foo’);
  • 22.
  • 23. 2 0 0 I S N O T T H E O N L Y S U C C E S S K N O W Y O U R C O D E S if ($statusCode != 200) { throw new Exception('AAGHH!!'); }
  • 24. 2xx is all about success 3xx is all about redirection 4xx is all about client errors 5xx is all about service errors
  • 25. 200 - Generic everything is OK 201 - Created something OK 202 - Accepted but is being processed async 400 - Bad Request (Validation?) 401 - Unauthorized 403 - Current user is forbidden 404 - That URL is not a valid route 405 - Method Not Allowed 410 - Data has been deleted, deactivated, suspended, etc 500 - Something unexpected happened and it is the APIs fault 503 - API is not here right now, please try again later
  • 26. 418 - I am a Teapot http://httpstatus.es/418
  • 27. C L E A R , H U M A N E R R O R S W H A T H A P P E N E D { "error": { "errors": [ { "domain": "youtube.parameter", "reason": "missingRequiredParameter", "message": "No filter selected.", "locationType": "parameter", "location": "" } ], "code": 400, "message": "No filter selected." } }
  • 28. E R R O R S S H O U L D M A K E S E N S E W H A T H A P P E N E D &mine=true "reason": "missingRequiredParameter", "message": "No filter selected.", … WTF
  • 29. S U P P L E M E N T H T T P C O D E S W H A T H A P P E N E D { "error": { "type": "OAuthException", "message": "Session has expired at unix time 138 } }
  • 30. S U P P L E M E N T H T T P C O D E S W H A T H A P P E N E D { "error": { "message": "(#210) Subject must be a page.", "type": "OAuthException", "code": 210 } }
  • 31. S U P P L E M E N T H T T P C O D E S W H A T H A P P E N E D { "error": { "message": "(#210) Subject must be a page.", "type": "OAuthException", "code": 210, "url": “http://developers.facebook.com/errors#210“ } }
  • 32. O A U T H 2 . 0 thephpleague.com github.com/thephpleague/oauth2-server
  • 33. O A U T H 2 C A N D O A L O T P A S S W O R D S , I M P L I C I T , S O C I A L L O G I N S …
  • 34. U S E S S L
  • 35. L O L E X C E P T F O R …
  • 36. F A C E B O O K … Y O U B # % @ * D S ! ! ! S E R I O U S L Y Refresh Tokens? Lol
  • 37. Y O U T U B E … Y O U S E M I - B # % @ * D S ! ! ! S T I L L S E R I O U S L Y Refresh Tokens? Kinda
  • 38. P R E S E N T A T I O N L A Y E R D O N T L E T U S E R S B E H I N D T H E C U R T A I N
  • 39. return Places::all(); P R E S E N T A T I O N L A Y E R D O N T L E T U S E R S B E H I N D T H E C U R T A I N
  • 40.
  • 41.
  • 42. T R A N S F O R M E R S … A S S E M B L E ! public function transform(Book $book) { return [ 'id' => (int) $book->id, 'title' => $book->title, 'year' => $book->yr, ‘created' => (string) $book->created_at, ]; } fractal.thephpleague.com
  • 43. F L E X I B L E R E S P O N S E S S T O P Y O U R I P H O N E D E V C O M P L A I N I N G GET /checkins/dsfXte ?include=place,user,activity
  • 44. P A G I N A T E D A T A G R O W S F A S T { "data": [ ... ], "cursors": { "after": "MTI=", "next_url": "https://api.example.com/places ?cursor=MTI%3" } }
  • 45. D E F I N E A L I M I T R A N G E P A G I N A T I O N D D O S if ($limit < 1 || $limit > 100) { $limit = 100; }
  • 46. A U T O M A T E T E S T I N G I F Y O U L O V E Y O U R J O B http://www.engineersgotblued.com/
  • 47. P H P U N I T + B E H A T http://www.bil-jac.com/bestfriendsclub.php
  • 48. Scenario: Find a merchant When I request "GET /moments/1" Then I get a "200" response And scope into the "data" property And the properties exist: """ id title year created """
  • 49. Scenario: Try to find an ` checkin When I request "GET /checkins/nope" Then I get a "404" response
  • 50. Scenario:Wrong Arguments for user follow Given I have the payload: """ {"is_following": "foo"} """ When I request "PUT /users/1” Then I get a "400" response Not a boolean
  • 52.
  • 53. V E R S I O N I N G / V 1 / D O E S N T C O U N T https://api.example.com/v1/places
  • 54. V E R S I O N I N G / V 1 / D O E S N T C O U N T https://api-v1.example.com/places
  • 55. V E R S I O N I N G / V 1 / D O E S N T C O U N T Accept: application/vnd.example+json; version=1 Accept: application/vnd.example+json; version=2
  • 56. V E R S I O N I N G / V 1 / D O E S N T C O U N T Accept: application/vnd.example.user+json; version=1 Accept: application/vnd.example.user+json; version=2
  • 57. V E R S I O N I N G / V 1 / D O E S N T C O U N T Copy Facebook Maybe? THIS ONE TIME! Facebook ruined the one good thing they ever did
  • 58. E V E R Y T H I N G I S W R O N G D O N T B E T H A T G U Y troyhunt.com/2014/02/your-api-versioning-is-wrong-which-is.html