From 1a3933cd80d1d1a5bb592b0e1e3f29c3b58b0a86 Mon Sep 17 00:00:00 2001 From: Todd Fredrich Date: Mon, 31 Aug 2015 23:41:24 -0600 Subject: [PATCH] Fixed issue with post & get tabs. Added Google AdSense. --- lessons/httpmethods.html | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lessons/httpmethods.html b/lessons/httpmethods.html index 1e9bc88..4156ad9 100644 --- a/lessons/httpmethods.html +++ b/lessons/httpmethods.html @@ -35,6 +35,20 @@
+
+ +

Using HTTP Methods for RESTful Services

@@ -102,7 +116,7 @@
  • DELETE
  • -
    +

    The POST verb is most-often utilized to **create** new resources. In particular, it's used to create subordinate resources. That is, subordinate to some other (e.g. parent) resource. In other words, when creating a new resource, POST to the parent and the service takes care of associating the new resource with the parent, assigning an ID (new resource URI), etc.

    On successful creation, return HTTP status 201, returning a Location header with a link to the newly-created resource with the 201 HTTP status.

    POST is neither safe nor idempotent. It is therefore recommended for non-idempotent resource requests. Making two identical POST requests will most-likely result in two resources containing the same information.

    @@ -112,7 +126,7 @@
  • POST http://www.example.com/customers/12345/orders
  • -
    +

    The HTTP GET method is used to **read** (or retrieve) a representation of a resource. In the “happy” (or non-error) path, GET returns a representation in XML or JSON and an HTTP response code of 200 (OK). In an error case, it most often returns a 404 (NOT FOUND) or 400 (BAD REQUEST).

    According to the design of the HTTP specification, GET (along with HEAD) requests are used only to read data and not change it. Therefore, when used this way, they are considered safe. That is, they can be called without risk of data modification or corruption—calling it once has the same effect as calling it 10 times, or none at all. Additionally, GET (and HEAD) is idempotent, which means that making multiple identical requests ends up having the same result as a single request.

    Do not expose unsafe operations via GET—it should never modify any resources on the server.