SlideShare a Scribd company logo
OUTLINE
• What is an API?
• Why are API’s useful?
• What is HTTP? JSON? XML?
• What is a RESTful API?
• How do we consume an API?
• How do we create an API?
API’s are available from many large
websites and businesses
WHAT IS AN API?
• API = Application Programming Interface
• You use API’s all the time. Scanner class Java
• Web API: A set of methods exposed over the
web via HTTP to allow programmatic access to
applications.
• Allows you to quickly add functionality/data
that others have created.
• Very similar to how a web page works
WHY API’S ARE USEFUL
• Abstraction / DRY Principle
• Less data transfer
• Can be implemented or consumed in almost any language
• Can expose some methods to public developers
• Allows frontend developers and backend developers to agree
on a common interface
HTTP, JSON, XML
• Three important technologies that are often used by API’s
• HTTP: Hyper text transfer protocol, transfers data over a network
• GET : Read
• POST : Create
• PUT : Update
• PATCH : Partial Update
• DELETE : Delete
• JSON: JavaScript Object Notation, a format for data transfer
• {“key”: “value”, “key2”:{“subkey”: 2, “error”: false}}
• XML: EXtensible Markup Language: a format for data transfer
• Designed to be human and machine readable
<?PHP json_decode(‘{“key”:true}’); ?>
WHAT IS A RESTFUL API?
• Uniform Interface
• Resources (Nouns) URI’s that HTTP Verbs act on. The uniform interface
allows Client / Server to evolve independently.
• Stateless
• Ever have back button issues? Stateless does not care what order requests
are made in.
• Cacheable
• Client-Server
• Separation, client should not manage database, server should not manage
UI.
• Layered System
• Can uses layered system, cache, middle ware, load balancing, redundancy
etc.
https://api.example.com/v1/resource/identifier/relation?filtersortParams=value GitHub's API lets you star a gist with
PUT /gists/:id/star and unstar
with DELETE /gists/:id/star.
HOW TO CONSUME AN API
• Firefox: RESTClient
• Chrome: Postman
• Online: https://www.hurl.it/
• Examples:
• http://nflarrest.com/api/v1/team
• http://buscentral.herokuapp.com/suggestions POST (Feedback, message) or GET
• https://www.youtube.com/watch?v=suHY8dLKzCU
HOW DO DESIGN AN API
• Gather requirements from stakeholders
• Create use cases, and decide the functionality needed
• Think skeptically, make sure you explore your options
• Think ahead, make a flexible system
• Easy To learn and use, even without
documentation
• Hard to misuse
• Easy to read and maintain code that
uses it
• Sufficiently powerful to satisfy
requirements and Appropriate to
audience
• Easy to evolve (Use arrays for example)
Rules for a good API
CREATING A SIMPLE API
• You can use any hostable language with a HTTP library (Almost all of them)
• Decide your resources, then decide the verbs.
• Useful to wireframe the UI at this stage
• Connect to persistent data store
• Remember the principles of REST
• Example in Node.JS: https://github.com/PatrickMurphy/VoteSmart
ADVANCED TOPICS
• Use API Keys
• pass as a parameter
• Rate Limiting
• Headers
• X-Rate-Limit-Limit - The number of allowed requests in the
current period
• X-Rate-Limit-Remaining - The number of remaining requests
in the current period
• X-Rate-Limit-Reset - The number of seconds left in the
current period
• Authentication
• A REST API should be stateless, send auth with
every request
• Use ssl, send auth username and base64 password
over authentication header
• Caching
• HTTP Provides this!
• Last-Modified header
• Etag header, hash or checksum, If-None-Match: “etag”
• Errors
• { "code" : 1234, "message" : "Something bad happened
:(", "description" : "More details about the error here" }
• Send HTTP Status 400 level
• 401 unauthorized
• 403 forbidden
• 404 not found
• 405 method not allowed
• 410 gone (depreciated)
• 422 Unprocessable entity (validation)
• 429 Too many requests (Rate limit)

More Related Content

PPTX
Api crash
PPTX
Rest api to integrate with your site
PPTX
How to build a rest api
PDF
Best Practice in Web Service Design
PPTX
4th Lecture: JSP and such
PPTX
Technology Stack Discussion
PPTX
Web Planning an Effective Integration with a 3rd party API to Scale
PDF
Why use Go for web development?
Api crash
Rest api to integrate with your site
How to build a rest api
Best Practice in Web Service Design
4th Lecture: JSP and such
Technology Stack Discussion
Web Planning an Effective Integration with a 3rd party API to Scale
Why use Go for web development?

What's hot (16)

PPTX
Saving Time By Testing With Jest
PPTX
Functional Programming in PHP
PPTX
REST and ASP.NET Web API (Tunisia)
PPTX
10 tips to make your ASP.NET Apps Faster
PPTX
Getting Started with ASP.NET 5
PDF
PPTX
Building rest services using aspnetwebapi
PDF
Tech Stack Ideas
PPTX
Microsoft Azure DocumentDB - Global Azure Bootcamp 2016
PPTX
Automating JavaScript testing with Jasmine and Perl
PPTX
Postman. From simple API test to end to end scenario
PDF
Automating and Testing a REST API
PPTX
Rest API Testing
PDF
A Day of REST
PPTX
PDF
Webservices: connecting Joomla! with other programs.
Saving Time By Testing With Jest
Functional Programming in PHP
REST and ASP.NET Web API (Tunisia)
10 tips to make your ASP.NET Apps Faster
Getting Started with ASP.NET 5
Building rest services using aspnetwebapi
Tech Stack Ideas
Microsoft Azure DocumentDB - Global Azure Bootcamp 2016
Automating JavaScript testing with Jasmine and Perl
Postman. From simple API test to end to end scenario
Automating and Testing a REST API
Rest API Testing
A Day of REST
Webservices: connecting Joomla! with other programs.
Ad

Viewers also liked (20)

PPTX
Mapa de riesgo
PPTX
Cache recap
PPTX
Rest api to integrate with your site
PPTX
Cache recap
PPTX
Αρχιτεκτονικό σχέδιο
PPTX
Cobol, lisp, and python
PPTX
Optimizing shared caches in chip multiprocessors
PDF
AWS ElasticBeansTalk
PPTX
Exception handling
PPTX
Ruby on rails evaluation
PDF
Estado del recurso suelo en Guatemala, prioridades y necesidades para su mane...
 
PPTX
Multithreading models.ppt
PDF
Αναθέσεις Μαθημάτων ΕΠΑΛ - ΦΕΚ 1671 10-06-2016
PPT
Ψηφιακή Χαρτογραφία & Γεωπληροφορική - 2ο μέρος
PPTX
Object oriented analysis
PPTX
Python language data types
PPTX
Classification of memory hierarchy in system unit
PPT
pipeline and vector processing
PPT
Parallel computing
PDF
11 abstract data types
Mapa de riesgo
Cache recap
Rest api to integrate with your site
Cache recap
Αρχιτεκτονικό σχέδιο
Cobol, lisp, and python
Optimizing shared caches in chip multiprocessors
AWS ElasticBeansTalk
Exception handling
Ruby on rails evaluation
Estado del recurso suelo en Guatemala, prioridades y necesidades para su mane...
 
Multithreading models.ppt
Αναθέσεις Μαθημάτων ΕΠΑΛ - ΦΕΚ 1671 10-06-2016
Ψηφιακή Χαρτογραφία & Γεωπληροφορική - 2ο μέρος
Object oriented analysis
Python language data types
Classification of memory hierarchy in system unit
pipeline and vector processing
Parallel computing
11 abstract data types
Ad

Similar to Api crash (20)

PDF
REST API Recommendations
PPTX
Scaling with swagger
PPTX
API Docs with OpenAPI 3.0
PPTX
RESTful Services
PDF
Api fundamentals
PDF
Api FUNdamentals #MHA2017
PPTX
ASP.NET Mvc 4 web api
PPTX
Rest APIs Training
PDF
Restful风格ž„web服务架构
PPTX
Build Modern Web Apps Using ASP.NET Web API and AngularJS
PPTX
Php internal architecture
PPSX
Advanced Web Development in PHP - Understanding REST API
PDF
CNIT 129S: Ch 3: Web Application Technologies
PPTX
PDF
Best Practices in Web Service Design
PDF
Intro to CakePHP
PPTX
Web Application Development using PHP Chapter 1
PDF
CNIT 129S - Ch 3: Web Application Technologies
PDF
Middleware in Golang: InVision's Rye
PPT
Introduction to the Web API
REST API Recommendations
Scaling with swagger
API Docs with OpenAPI 3.0
RESTful Services
Api fundamentals
Api FUNdamentals #MHA2017
ASP.NET Mvc 4 web api
Rest APIs Training
Restful风格ž„web服务架构
Build Modern Web Apps Using ASP.NET Web API and AngularJS
Php internal architecture
Advanced Web Development in PHP - Understanding REST API
CNIT 129S: Ch 3: Web Application Technologies
Best Practices in Web Service Design
Intro to CakePHP
Web Application Development using PHP Chapter 1
CNIT 129S - Ch 3: Web Application Technologies
Middleware in Golang: InVision's Rye
Introduction to the Web API

More from James Wong (20)

PPT
Data race
PPT
Multi threaded rtos
PPT
Recursion
PPTX
Business analytics and data mining
PPTX
Data mining and knowledge discovery
PPTX
Cache recap
PPTX
Big picture of data mining
PPTX
How analysis services caching works
PPTX
Optimizing shared caches in chip multiprocessors
PPTX
Directory based cache coherence
PPT
Abstract data types
PPTX
Abstraction file
PPTX
Hardware managed cache
PPTX
Object model
PPT
Abstract class
PPTX
Object oriented analysis
PPTX
Concurrency with java
PPTX
Data structures and algorithms
PPTX
Cobol, lisp, and python
PPTX
Inheritance
Data race
Multi threaded rtos
Recursion
Business analytics and data mining
Data mining and knowledge discovery
Cache recap
Big picture of data mining
How analysis services caching works
Optimizing shared caches in chip multiprocessors
Directory based cache coherence
Abstract data types
Abstraction file
Hardware managed cache
Object model
Abstract class
Object oriented analysis
Concurrency with java
Data structures and algorithms
Cobol, lisp, and python
Inheritance

Recently uploaded (20)

PDF
Approach and Philosophy of On baking technology
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Machine learning based COVID-19 study performance prediction
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
cuic standard and advanced reporting.pdf
PPTX
Cloud computing and distributed systems.
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Electronic commerce courselecture one. Pdf
PPTX
MYSQL Presentation for SQL database connectivity
Approach and Philosophy of On baking technology
Understanding_Digital_Forensics_Presentation.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Review of recent advances in non-invasive hemoglobin estimation
NewMind AI Monthly Chronicles - July 2025
Machine learning based COVID-19 study performance prediction
Mobile App Security Testing_ A Comprehensive Guide.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
cuic standard and advanced reporting.pdf
Cloud computing and distributed systems.
Unlocking AI with Model Context Protocol (MCP)
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Digital-Transformation-Roadmap-for-Companies.pptx
Electronic commerce courselecture one. Pdf
MYSQL Presentation for SQL database connectivity

Api crash

  • 1. OUTLINE • What is an API? • Why are API’s useful? • What is HTTP? JSON? XML? • What is a RESTful API? • How do we consume an API? • How do we create an API? API’s are available from many large websites and businesses
  • 2. WHAT IS AN API? • API = Application Programming Interface • You use API’s all the time. Scanner class Java • Web API: A set of methods exposed over the web via HTTP to allow programmatic access to applications. • Allows you to quickly add functionality/data that others have created. • Very similar to how a web page works
  • 3. WHY API’S ARE USEFUL • Abstraction / DRY Principle • Less data transfer • Can be implemented or consumed in almost any language • Can expose some methods to public developers • Allows frontend developers and backend developers to agree on a common interface
  • 4. HTTP, JSON, XML • Three important technologies that are often used by API’s • HTTP: Hyper text transfer protocol, transfers data over a network • GET : Read • POST : Create • PUT : Update • PATCH : Partial Update • DELETE : Delete • JSON: JavaScript Object Notation, a format for data transfer • {“key”: “value”, “key2”:{“subkey”: 2, “error”: false}} • XML: EXtensible Markup Language: a format for data transfer • Designed to be human and machine readable <?PHP json_decode(‘{“key”:true}’); ?>
  • 5. WHAT IS A RESTFUL API? • Uniform Interface • Resources (Nouns) URI’s that HTTP Verbs act on. The uniform interface allows Client / Server to evolve independently. • Stateless • Ever have back button issues? Stateless does not care what order requests are made in. • Cacheable • Client-Server • Separation, client should not manage database, server should not manage UI. • Layered System • Can uses layered system, cache, middle ware, load balancing, redundancy etc. https://api.example.com/v1/resource/identifier/relation?filtersortParams=value GitHub's API lets you star a gist with PUT /gists/:id/star and unstar with DELETE /gists/:id/star.
  • 6. HOW TO CONSUME AN API • Firefox: RESTClient • Chrome: Postman • Online: https://www.hurl.it/ • Examples: • http://nflarrest.com/api/v1/team • http://buscentral.herokuapp.com/suggestions POST (Feedback, message) or GET • https://www.youtube.com/watch?v=suHY8dLKzCU
  • 7. HOW DO DESIGN AN API • Gather requirements from stakeholders • Create use cases, and decide the functionality needed • Think skeptically, make sure you explore your options • Think ahead, make a flexible system • Easy To learn and use, even without documentation • Hard to misuse • Easy to read and maintain code that uses it • Sufficiently powerful to satisfy requirements and Appropriate to audience • Easy to evolve (Use arrays for example) Rules for a good API
  • 8. CREATING A SIMPLE API • You can use any hostable language with a HTTP library (Almost all of them) • Decide your resources, then decide the verbs. • Useful to wireframe the UI at this stage • Connect to persistent data store • Remember the principles of REST • Example in Node.JS: https://github.com/PatrickMurphy/VoteSmart
  • 9. ADVANCED TOPICS • Use API Keys • pass as a parameter • Rate Limiting • Headers • X-Rate-Limit-Limit - The number of allowed requests in the current period • X-Rate-Limit-Remaining - The number of remaining requests in the current period • X-Rate-Limit-Reset - The number of seconds left in the current period • Authentication • A REST API should be stateless, send auth with every request • Use ssl, send auth username and base64 password over authentication header • Caching • HTTP Provides this! • Last-Modified header • Etag header, hash or checksum, If-None-Match: “etag” • Errors • { "code" : 1234, "message" : "Something bad happened :(", "description" : "More details about the error here" } • Send HTTP Status 400 level • 401 unauthorized • 403 forbidden • 404 not found • 405 method not allowed • 410 gone (depreciated) • 422 Unprocessable entity (validation) • 429 Too many requests (Rate limit)

Editor's Notes

  • #3: Who has worked with api’s or web services before?
  • #4: If you have learned about OOP
  • #5: Who has taken networks?