Let's Talk APIs

Well...RESTful ones anyway

What is an API?

  • Application
  • Programming
  • Interface

Let other people use your stuff!

API Documentation

What is RESTful?

  • REpresentational
  • State
  • Transfer

Constraints to create consistent APIs

REST COnstraints

  • Client-server
  • Stateless
  • Cacheable
  • Layered System
  • Code on demand
  • Uniform interface

REST on the Web

  • Take a base URI
  • Pick a data type (JSON, XML, Atom, etc)
  • Use standard HTTP methods
    • GET, PUT, POST, DELETE, (and PATCH)
  • Use standard HTTP response codes
    • 200 OK, 204 No Content, 404 Not Found

A RESTful Example

  • List: GET /jokes
  • Create: POST /jokes
  • Show: GET /jokes/1
  • Update: PUT /jokes/1
  • Delete: DELETE /jokes/1

Sample Code

Resources

Other Talks

Made with Slides.com