1. Defining the Resource
  2. Verbs and Web API
  3. Content Negotiation
  4. Tools for Testing (Fiddler, PostMan)
  5. Consuming a REST API using jQuery


Defining the Resource

  • Defining Web API Resources
  • Collection or Singleton: /widgets or /widgets/1
  • Navigation: /widgets/1/things or /widgets/1/things/1
  • Nouns
    “Target of a hypertext reference”
  • Avoid exposing business logic, i.e. if a process requires orchestration across multiple resources, make the process the noun
  • In Web API, a resource is typically a controller

Verbs and Web API

Planning actions in your API:

  • GET – “read”
  • POST – “insert” (collection)
  • PUT – “replace”
  • DELETE – “remove”
  • PATCH – “update”
  • Custom (proceed with caution)

Content Negotiation

Tools for Testing (Fiddler, PostMan)

Consuming a REST API using jQuery

Why JSON is such a good thing :

  • $.ajax
  • Verbs (PUT, POST, GET)
  • URL (resource)
  • Data
  • DataType
  • JSON makes it really, really easy to turn into a JavaScript object