SlideShare a Scribd company logo
BUILDING REST APIS THAT DON’T
SUCK FOR MODERN DAY SPAS
Adewale Abati
ABATI “ACEKYD” ADEWALE
Web Engineer
Community Manager &
Developer Advocate @
Ingressive
Open source Enthusiast
YouTuber
Gamer & Basketballer
WHO AM I?
@acekyd @ace_kyd
BUILDING REST APIS THAT DON’T SUCK FOR MODERN DAY SPAS
WHAT WE WOULD BE TALKING ABOUT
What are Single Page Applications
How do REST APIs come in
Common Practices for REST API structures.
API Accessibility tips
Documentation tips
Error handling and status codes tips
Differences in building private APIs from experience.
WHAT ARE SINGLE PAGE APPLICATIONS?
A single page application also known as SPA is a web
application or website that interacts with the user by
dynamically rewriting the current page rather than
loading entire new pages from a server.
It does not require page reloading during use by relying on the features
and capabilities of modern web browsers.
WHAT ARE SINGLE PAGE APPLICATIONS?
SINGLE PAGE APPLICATIONS ARE AS A RESULT OF
Modern browsers
JavaScript becoming increasingly powerful
HTML5 capabilities
Heightened focus on user interfaces and experience
COMMON FRAMEWORKS FOR BUILDING SINGLE PAGE APPLICATIONS
COMMON FRAMEWORKS FOR BUILDING SINGLE PAGE APPS
…and many more…
HOW DO REST APIS
COME IN?
A RESTful API is a standard pattern for APIs
that use HTTP requests to GET, PUT, POST
and DELETE data.
HOW DO REST APIS COME IN?
Source:https://msdn.microsoft.com/en-us/magazine/dn463786.aspx
API ACCESSIBILITY TIPS
BUILDING AN ACCESSIBLE API
Users should be able to get up and running with a basic
implementation of your API in about 15 minutes
Think in resources for endpoints.
Think nouns not verbs. Leave verbs to request methods.
Same endpoint structure (plural endpoints) - Be consistent
Avoid breaking changes to existing endpoints.
Performance and speed are important.
THINK IN RESOURCES FOR ENDPOINTS
API ACCESSIBILITY TIPS
NOUNS NOT VERBS. LEAVE VERBS FOR REQUEST METHODS
API ACCESSIBILITY TIPS
AVOID BREAKING CHANGES
API ACCESSIBILITY TIPS
DOCUMENTATION BEST PRACTICES
First entry point for users
Include a tutorial or summary of what can be done with
the API
Include example requests and responses
Use generators or tools to create nice documentation.
Provide information on each endpoint.
DOCUMENTATION BEST PRACTICES
DOCUMENTATION BEST PRACTICES
INCLUDE SUMMARY FOR API
The Twilio REST API quickly highlights all the things you
can do with their API. Giving you an idea of the features
available to you at a glance.
DOCUMENTATION BEST PRACTICES
INCLUDE TUTORIALS WHERE POSSIBLE FOR API
DOCUMENTATION BEST PRACTICES
INCLUDE TUTORIALS WHERE POSSIBLE FOR API
DOCUMENTATION BEST PRACTICES
EXAMPLE REQUESTS AND RESPONSES
COMMON TOOLS FOR MAKING API DOCUMENTATION
DOCUMENTATION BEST PRACTICES
APIDOCjs.com
COMMON TOOLS FOR MAKING API DOCUMENTATION
DOCUMENTATION BEST PRACTICES
swagger.io
COMMON TOOLS FOR MAKING API DOCUMENTATION
DOCUMENTATION BEST PRACTICES
https://spectrum.chat/slate
HANDLING ERRORS, RESPONSES & STATUS CODES
HANDLING ERRORS, RESPONSES & STATUS CODES
Validation - Validate everything
Be consistent with your response format.
Use common status codes with responses
2xx (Success category) - 200 Ok, 201 Created, 204 No content
3xx (Redirection category) - 304 Not Modified
4xx (Client Error category) - 400 Bad Request, 401 Unauthorized, 403
Forbidden, 404 Not Found
5xx (Server Error category) - 500 Internal Server Error, 503 Service
Unavailable.
PRIVATE API
BUILDING A PRIVATE API
Look at UI designs before implementing API
Recommended to have an understanding of how the
frontend app works to better know how to present data
Start with authentication before going deep into the API
features when necessary.
Maintain good documentation.
QUESTIONS?@acekyd @ace_kyd

More Related Content

Building REST APIs that don't suck for modern day SPAs

  • 1. BUILDING REST APIS THAT DON’T SUCK FOR MODERN DAY SPAS Adewale Abati
  • 2. ABATI “ACEKYD” ADEWALE Web Engineer Community Manager & Developer Advocate @ Ingressive Open source Enthusiast YouTuber Gamer & Basketballer WHO AM I? @acekyd @ace_kyd
  • 3. BUILDING REST APIS THAT DON’T SUCK FOR MODERN DAY SPAS WHAT WE WOULD BE TALKING ABOUT What are Single Page Applications How do REST APIs come in Common Practices for REST API structures. API Accessibility tips Documentation tips Error handling and status codes tips Differences in building private APIs from experience.
  • 4. WHAT ARE SINGLE PAGE APPLICATIONS? A single page application also known as SPA is a web application or website that interacts with the user by dynamically rewriting the current page rather than loading entire new pages from a server. It does not require page reloading during use by relying on the features and capabilities of modern web browsers.
  • 5. WHAT ARE SINGLE PAGE APPLICATIONS? SINGLE PAGE APPLICATIONS ARE AS A RESULT OF Modern browsers JavaScript becoming increasingly powerful HTML5 capabilities Heightened focus on user interfaces and experience
  • 6. COMMON FRAMEWORKS FOR BUILDING SINGLE PAGE APPLICATIONS COMMON FRAMEWORKS FOR BUILDING SINGLE PAGE APPS …and many more…
  • 7. HOW DO REST APIS COME IN? A RESTful API is a standard pattern for APIs that use HTTP requests to GET, PUT, POST and DELETE data.
  • 8. HOW DO REST APIS COME IN? Source:https://msdn.microsoft.com/en-us/magazine/dn463786.aspx
  • 9. API ACCESSIBILITY TIPS BUILDING AN ACCESSIBLE API Users should be able to get up and running with a basic implementation of your API in about 15 minutes Think in resources for endpoints. Think nouns not verbs. Leave verbs to request methods. Same endpoint structure (plural endpoints) - Be consistent Avoid breaking changes to existing endpoints. Performance and speed are important.
  • 10. THINK IN RESOURCES FOR ENDPOINTS API ACCESSIBILITY TIPS
  • 11. NOUNS NOT VERBS. LEAVE VERBS FOR REQUEST METHODS API ACCESSIBILITY TIPS
  • 12. AVOID BREAKING CHANGES API ACCESSIBILITY TIPS
  • 13. DOCUMENTATION BEST PRACTICES First entry point for users Include a tutorial or summary of what can be done with the API Include example requests and responses Use generators or tools to create nice documentation. Provide information on each endpoint. DOCUMENTATION BEST PRACTICES
  • 14. DOCUMENTATION BEST PRACTICES INCLUDE SUMMARY FOR API The Twilio REST API quickly highlights all the things you can do with their API. Giving you an idea of the features available to you at a glance.
  • 15. DOCUMENTATION BEST PRACTICES INCLUDE TUTORIALS WHERE POSSIBLE FOR API
  • 16. DOCUMENTATION BEST PRACTICES INCLUDE TUTORIALS WHERE POSSIBLE FOR API
  • 17. DOCUMENTATION BEST PRACTICES EXAMPLE REQUESTS AND RESPONSES
  • 18. COMMON TOOLS FOR MAKING API DOCUMENTATION DOCUMENTATION BEST PRACTICES APIDOCjs.com
  • 19. COMMON TOOLS FOR MAKING API DOCUMENTATION DOCUMENTATION BEST PRACTICES swagger.io
  • 20. COMMON TOOLS FOR MAKING API DOCUMENTATION DOCUMENTATION BEST PRACTICES https://spectrum.chat/slate
  • 21. HANDLING ERRORS, RESPONSES & STATUS CODES HANDLING ERRORS, RESPONSES & STATUS CODES Validation - Validate everything Be consistent with your response format. Use common status codes with responses 2xx (Success category) - 200 Ok, 201 Created, 204 No content 3xx (Redirection category) - 304 Not Modified 4xx (Client Error category) - 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found 5xx (Server Error category) - 500 Internal Server Error, 503 Service Unavailable.
  • 22. PRIVATE API BUILDING A PRIVATE API Look at UI designs before implementing API Recommended to have an understanding of how the frontend app works to better know how to present data Start with authentication before going deep into the API features when necessary. Maintain good documentation.