SlideShare a Scribd company logo
1 of 14
Building APIs that
don’t suck!
(To be taken with a grain of salt)
Why?
Endpoint Theory
Noun vs Verb
POST /users
POST /users/create
Resources are Nouns
Verbs can be made Nouns
POST /users/123/checkin
POST /users/123/checkins
Endpoint Theory contd...
Singular vs Plural
GET /users/1,GET /users
GET /user/1, GET /users
Use HTTP Verbs appropriately
GET Retrieve GET /users/123
POST Create POST /users
PUT Replace PUT /users/123
PATCH Update PATCH /users/123
DELET
E
Delete DELETE /users/123
Resource Relationships - keep it simple
GET /users/1/checkins
GET /users/1/checkins/123
GET /checkins/123
Use HTTP Status Codes appropriately
2xx Success 200(OK), 202(Created)
3xx Redirect 301(Redirect), 303(Moved
Permanently)
4xx Client Error 400(Bad Req), 401(Unauthorized),
404(Not Found),
422(Unprocessable)
5xx Server Error 500(Internal Err)
Payload Design - think of the user
{
"data": {
"type": "entity_type"
"attributes": {
....
}
}
}
{
"errors": {
"status": 422,
"title": "Bad api call",
"detail": "Details...”
}
}
HATEOAS & being RESTful
1. Content Negotiation
Hypermedia As The Engine Of Application State
GET /configs
HTTP Header:
Accept: application/x-yaml
HATEOAS & being RESTful
2. Hypermedia
Controls
"data": {
"type": "users"
"attributes": {
....
},
"links": [ {
"rel": "self",
"uri": "/users/1"
}, {
"rel": "checkins",
"uri": "/users/1/checkins"
}]
}
FAQ
Versioning - Semantic Versioning (http://semver.org)
Documentation - Slate or Swagger
Testing - JSON-Schema validation
Standards - JSON-API, but I can’t recommend it!
UGLY Parts - Filtering, Foreign-Key relations, Sideloading
GraphQL - Not a REST API, Infinite API
Take Away
API
Be thoughtful when designing APIs
Follow good practices
Stay consistent
Try not to break it (Semantic versioning)
TLC
Thank you
“Life is short.. Work somewhere
awesome”
http://www.enova.com

More Related Content

Similar to Building apis that don’t suck!

Multi Client Development with Spring for SpringOne 2GX 2013 with Roy Clarkson
Multi Client Development with Spring for SpringOne 2GX 2013 with Roy ClarksonMulti Client Development with Spring for SpringOne 2GX 2013 with Roy Clarkson
Multi Client Development with Spring for SpringOne 2GX 2013 with Roy ClarksonJoshua Long
 
Modelling RESTful applications – Why should I not use verbs in REST url
Modelling RESTful applications – Why should I not use verbs in REST urlModelling RESTful applications – Why should I not use verbs in REST url
Modelling RESTful applications – Why should I not use verbs in REST urlXebia IT Architects
 
Whatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the processWhatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the processguest3379bd
 
An introduction to Struts 2 and RESTful applications
An introduction to Struts 2 and RESTful applicationsAn introduction to Struts 2 and RESTful applications
An introduction to Struts 2 and RESTful applicationsmrdon
 
Rest in practice
Rest in practiceRest in practice
Rest in practiceGabor Torok
 
Mtn view sql server nov 2014
Mtn view sql server nov 2014Mtn view sql server nov 2014
Mtn view sql server nov 2014EspressoLogic
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API07.pallav
 
Internet Explorer 8 for Developers by Christian Thilmany
Internet Explorer 8 for Developers by Christian ThilmanyInternet Explorer 8 for Developers by Christian Thilmany
Internet Explorer 8 for Developers by Christian ThilmanyChristian Thilmany
 
Data persistence using pouchdb and couchdb
Data persistence using pouchdb and couchdbData persistence using pouchdb and couchdb
Data persistence using pouchdb and couchdbDimgba Kalu
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETBen Hall
 
Android App Development 06 : Network & Web Services
Android App Development 06 : Network & Web ServicesAndroid App Development 06 : Network & Web Services
Android App Development 06 : Network & Web ServicesAnuchit Chalothorn
 
05 status-codes
05 status-codes05 status-codes
05 status-codessnopteck
 
Python RESTful webservices with Python: Flask and Django solutions
Python RESTful webservices with Python: Flask and Django solutionsPython RESTful webservices with Python: Flask and Django solutions
Python RESTful webservices with Python: Flask and Django solutionsSolution4Future
 

Similar to Building apis that don’t suck! (20)

Day02 a pi.
Day02   a pi.Day02   a pi.
Day02 a pi.
 
Web Scraping with PHP
Web Scraping with PHPWeb Scraping with PHP
Web Scraping with PHP
 
Multi Client Development with Spring for SpringOne 2GX 2013 with Roy Clarkson
Multi Client Development with Spring for SpringOne 2GX 2013 with Roy ClarksonMulti Client Development with Spring for SpringOne 2GX 2013 with Roy Clarkson
Multi Client Development with Spring for SpringOne 2GX 2013 with Roy Clarkson
 
Modelling RESTful applications – Why should I not use verbs in REST url
Modelling RESTful applications – Why should I not use verbs in REST urlModelling RESTful applications – Why should I not use verbs in REST url
Modelling RESTful applications – Why should I not use verbs in REST url
 
REST in Peace
REST in PeaceREST in Peace
REST in Peace
 
Whatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the processWhatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the process
 
An introduction to Struts 2 and RESTful applications
An introduction to Struts 2 and RESTful applicationsAn introduction to Struts 2 and RESTful applications
An introduction to Struts 2 and RESTful applications
 
Cqrs api v2
Cqrs api v2Cqrs api v2
Cqrs api v2
 
Rest in practice
Rest in practiceRest in practice
Rest in practice
 
Mtn view sql server nov 2014
Mtn view sql server nov 2014Mtn view sql server nov 2014
Mtn view sql server nov 2014
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API
 
Take a REST
Take a RESTTake a REST
Take a REST
 
Internet Explorer 8 for Developers by Christian Thilmany
Internet Explorer 8 for Developers by Christian ThilmanyInternet Explorer 8 for Developers by Christian Thilmany
Internet Explorer 8 for Developers by Christian Thilmany
 
Data persistence using pouchdb and couchdb
Data persistence using pouchdb and couchdbData persistence using pouchdb and couchdb
Data persistence using pouchdb and couchdb
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NET
 
Rest And Rails
Rest And RailsRest And Rails
Rest And Rails
 
Android App Development 06 : Network & Web Services
Android App Development 06 : Network & Web ServicesAndroid App Development 06 : Network & Web Services
Android App Development 06 : Network & Web Services
 
05 status-codes
05 status-codes05 status-codes
05 status-codes
 
Android and REST
Android and RESTAndroid and REST
Android and REST
 
Python RESTful webservices with Python: Flask and Django solutions
Python RESTful webservices with Python: Flask and Django solutionsPython RESTful webservices with Python: Flask and Django solutions
Python RESTful webservices with Python: Flask and Django solutions
 

More from Bud Siddhisena

Why should you android (archived)
Why should you android (archived)Why should you android (archived)
Why should you android (archived)Bud Siddhisena
 
Virtualization, The future of computing (archived)
Virtualization, The future of computing (archived)Virtualization, The future of computing (archived)
Virtualization, The future of computing (archived)Bud Siddhisena
 
Building the Next big thing (archived)
Building the Next big thing (archived)Building the Next big thing (archived)
Building the Next big thing (archived)Bud Siddhisena
 
GNU/Linux for a better home (archived)
GNU/Linux for a better home (archived)GNU/Linux for a better home (archived)
GNU/Linux for a better home (archived)Bud Siddhisena
 
Recipe of a linux Live CD (archived)
Recipe of a linux Live CD (archived)Recipe of a linux Live CD (archived)
Recipe of a linux Live CD (archived)Bud Siddhisena
 
Gaming on linux (archived)
Gaming on linux (archived)Gaming on linux (archived)
Gaming on linux (archived)Bud Siddhisena
 
FOSS in Sri Lanka (archived)
FOSS in Sri Lanka (archived)FOSS in Sri Lanka (archived)
FOSS in Sri Lanka (archived)Bud Siddhisena
 
Contributing to FOSS (archived)
Contributing to FOSS (archived)Contributing to FOSS (archived)
Contributing to FOSS (archived)Bud Siddhisena
 
Choosing your GNU/Linux distribution (archived)
Choosing your GNU/Linux distribution (archived)Choosing your GNU/Linux distribution (archived)
Choosing your GNU/Linux distribution (archived)Bud Siddhisena
 
Beyond desktop/server with GNU/Linux (archived)
Beyond desktop/server with GNU/Linux (archived)Beyond desktop/server with GNU/Linux (archived)
Beyond desktop/server with GNU/Linux (archived)Bud Siddhisena
 
Opensource opportunity
Opensource opportunityOpensource opportunity
Opensource opportunityBud Siddhisena
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with NginxBud Siddhisena
 
Introduction to firewalls through Iptables
Introduction to firewalls through IptablesIntroduction to firewalls through Iptables
Introduction to firewalls through IptablesBud Siddhisena
 
Secure your IT infrastructure with GNU/Linux
Secure your IT infrastructure  with GNU/LinuxSecure your IT infrastructure  with GNU/Linux
Secure your IT infrastructure with GNU/LinuxBud Siddhisena
 
Kernel Configuration and Compilation
Kernel Configuration and CompilationKernel Configuration and Compilation
Kernel Configuration and CompilationBud Siddhisena
 

More from Bud Siddhisena (20)

JIT qa-docker
JIT qa-dockerJIT qa-docker
JIT qa-docker
 
Why should you android (archived)
Why should you android (archived)Why should you android (archived)
Why should you android (archived)
 
Virtualization, The future of computing (archived)
Virtualization, The future of computing (archived)Virtualization, The future of computing (archived)
Virtualization, The future of computing (archived)
 
Building the Next big thing (archived)
Building the Next big thing (archived)Building the Next big thing (archived)
Building the Next big thing (archived)
 
GNU/Linux for a better home (archived)
GNU/Linux for a better home (archived)GNU/Linux for a better home (archived)
GNU/Linux for a better home (archived)
 
Recipe of a linux Live CD (archived)
Recipe of a linux Live CD (archived)Recipe of a linux Live CD (archived)
Recipe of a linux Live CD (archived)
 
Gaming on linux (archived)
Gaming on linux (archived)Gaming on linux (archived)
Gaming on linux (archived)
 
FOSS in Sri Lanka (archived)
FOSS in Sri Lanka (archived)FOSS in Sri Lanka (archived)
FOSS in Sri Lanka (archived)
 
Contributing to FOSS (archived)
Contributing to FOSS (archived)Contributing to FOSS (archived)
Contributing to FOSS (archived)
 
Choosing your GNU/Linux distribution (archived)
Choosing your GNU/Linux distribution (archived)Choosing your GNU/Linux distribution (archived)
Choosing your GNU/Linux distribution (archived)
 
Beyond desktop/server with GNU/Linux (archived)
Beyond desktop/server with GNU/Linux (archived)Beyond desktop/server with GNU/Linux (archived)
Beyond desktop/server with GNU/Linux (archived)
 
UX talk
UX talkUX talk
UX talk
 
Opensource opportunity
Opensource opportunityOpensource opportunity
Opensource opportunity
 
Remembering steve
Remembering steveRemembering steve
Remembering steve
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with Nginx
 
Introduction to firewalls through Iptables
Introduction to firewalls through IptablesIntroduction to firewalls through Iptables
Introduction to firewalls through Iptables
 
FOSS and Security
FOSS and SecurityFOSS and Security
FOSS and Security
 
Secure your IT infrastructure with GNU/Linux
Secure your IT infrastructure  with GNU/LinuxSecure your IT infrastructure  with GNU/Linux
Secure your IT infrastructure with GNU/Linux
 
Kernel Configuration and Compilation
Kernel Configuration and CompilationKernel Configuration and Compilation
Kernel Configuration and Compilation
 
Foss Gadgematics
Foss GadgematicsFoss Gadgematics
Foss Gadgematics
 

Recently uploaded

Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 

Recently uploaded (20)

Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 

Building apis that don’t suck!

  • 1. Building APIs that don’t suck! (To be taken with a grain of salt)
  • 3. Endpoint Theory Noun vs Verb POST /users POST /users/create
  • 4. Resources are Nouns Verbs can be made Nouns POST /users/123/checkin POST /users/123/checkins
  • 5. Endpoint Theory contd... Singular vs Plural GET /users/1,GET /users GET /user/1, GET /users
  • 6. Use HTTP Verbs appropriately GET Retrieve GET /users/123 POST Create POST /users PUT Replace PUT /users/123 PATCH Update PATCH /users/123 DELET E Delete DELETE /users/123
  • 7. Resource Relationships - keep it simple GET /users/1/checkins GET /users/1/checkins/123 GET /checkins/123
  • 8. Use HTTP Status Codes appropriately 2xx Success 200(OK), 202(Created) 3xx Redirect 301(Redirect), 303(Moved Permanently) 4xx Client Error 400(Bad Req), 401(Unauthorized), 404(Not Found), 422(Unprocessable) 5xx Server Error 500(Internal Err)
  • 9. Payload Design - think of the user { "data": { "type": "entity_type" "attributes": { .... } } } { "errors": { "status": 422, "title": "Bad api call", "detail": "Details...” } }
  • 10. HATEOAS & being RESTful 1. Content Negotiation Hypermedia As The Engine Of Application State GET /configs HTTP Header: Accept: application/x-yaml
  • 11. HATEOAS & being RESTful 2. Hypermedia Controls "data": { "type": "users" "attributes": { .... }, "links": [ { "rel": "self", "uri": "/users/1" }, { "rel": "checkins", "uri": "/users/1/checkins" }] }
  • 12. FAQ Versioning - Semantic Versioning (http://semver.org) Documentation - Slate or Swagger Testing - JSON-Schema validation Standards - JSON-API, but I can’t recommend it! UGLY Parts - Filtering, Foreign-Key relations, Sideloading GraphQL - Not a REST API, Infinite API
  • 13. Take Away API Be thoughtful when designing APIs Follow good practices Stay consistent Try not to break it (Semantic versioning) TLC
  • 14. Thank you “Life is short.. Work somewhere awesome” http://www.enova.com

Editor's Notes

  1. I wanted to get myself to read the book. So I signed up for an Enova tech tech talk, where I work.
  2. Prefer nouns to verbs to represent endpoints. Why? Because URLs represent a Resource which lives on the Internet. It’s a thing (noun)
  3. You can still make a verb into a noun if needed. Eg. checkin is an action but checkins a list of checkins. Like a verb but Likes a noun.
  4. Use Plural. Don’t use both. It’s more consistent and less ambiguous
  5. Verbs exist in the REST world. But use the HTTP built-ins to achieve it.
  6. Best not to go more than 1 level deep. If you need to do the 2nd example, do the last one instead
  7. Use HTTP status to convey how things went. Make a best effort to use the correct http status code (even though there are overlapping codes)
  8. Highly subjective, but try to come up with a payload design and try to be consistent. This design is inspired by json-api. Why not json-api? It can get too complex and ugly
  9. It ain’t RESTful if it doesn’t have HATEOAS. That’s what Roy Fielding, the inventor or REST says. Content negotiation not a big deal these days since it’s pretty much json.
  10. However supporting hypermedia links is important. It promotes organic API discoverability.
  11. Times almost up. The one I spent some time talking about is API testing via json-schema. I think it can be used to address most of API testing. If you want to be exact then use more exact matching of data against a golden file but IMHO that isn’t really needed here.
  12. Good API design is important. It imputes thoughtfulness into a well designed system (even if that is not the case :). Don’t think of APIs as web page replacements. Instead think of them as schemas and data. Thinking of good API designs may invite to re-evaluate current design decisions and set you on a path to simplicity nirvana.