Upgrade to Pro — share decks privately, control downloads, hide ads and more …

HTTP Methods

HTTP Methods

The most commonly used HTTP methods with their usage and properties. Slides for Ruby Talks at PGS Software.

mrzasa

July 06, 2016
Tweet

More Decks by mrzasa

Other Decks in Programming

Transcript

  1. HTTP REQUEST G E T / u s e r

    s H T T P / 1 . 1 A c c e p t ­ E n c o d i n g : g z i p ; q = 1 . 0 , d e f l a t e ; q = 0 . 6 , i d e n t i t y ; q = 0 . 3 A c c e p t : * / * U s e r ­ A g e n t : R u b y C o n n e c t i o n : c l o s e H o s t : e x a m p l e . c o m
  2. HTTP METHOD PROPERTIES safe methods no resource modifications idempotent methods

    called multiple leaves resource in the same state safe methods are idempotent
  3. SAFE GET retreive data identified by URL HEAD like GET

    but without body OPTIONS available communication options, e.g. CORS
  4. IDEMPOTENT PUT apply a new version of the resource (new

    or existing) PATCH apply a set of changes to the resource DELETE delete the resource
  5. EXAMPLES view a page (and record a page view) change

    an email of a user make a bank transfer buy a book increment a counter enable/disable option: toggle?
  6. SUMMARY NEVER change state using GET remember that PUT should

    be idempotent use idempotent methods where possible (TBC)