From 0cfe06f5f97d57a31662760f275b984792405d6c Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 8 Dec 2014 16:38:49 +0000 Subject: Update documentation --- tutorial/1-serialization/index.html | 48 ++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 8 deletions(-) (limited to 'tutorial/1-serialization/index.html') diff --git a/tutorial/1-serialization/index.html b/tutorial/1-serialization/index.html index 292b1099..7d2d3a4d 100644 --- a/tutorial/1-serialization/index.html +++ b/tutorial/1-serialization/index.html @@ -676,15 +676,47 @@ Development server is running at http://127.0.0.1:8000/ Quit the server with CONTROL-C.
In another terminal window, we can test the server.
-We can get a list of all of the snippets.
-curl http://127.0.0.1:8000/snippets/
-
-[{"id": 1, "title": "", "code": "foo = \"bar\"\n", "linenos": false, "language": "python", "style": "friendly"}, {"id": 2, "title": "", "code": "print \"hello, world\"\n", "linenos": false, "language": "python", "style": "friendly"}]
+We can test our API using using curl or httpie. Httpie is a user friendly http client that's written in Python. Let's install that.
+You can install httpie using pip:
+pip install httpie
-Or we can get a particular snippet by referencing its id.
-curl http://127.0.0.1:8000/snippets/2/
-
-{"id": 2, "title": "", "code": "print \"hello, world\"\n", "linenos": false, "language": "python", "style": "friendly"}
+Finally, we can get a list of all of the snippets:
+http http://127.0.0.1:8000/snippets/
+
+HTTP/1.1 200 OK
+...
+[
+ {
+ "id": 1,
+ "title": "",
+ "code": "foo = \"bar\"\n",
+ "linenos": false,
+ "language": "python",
+ "style": "friendly"
+ },
+ {
+ "id": 2,
+ "title": "",
+ "code": "print \"hello, world\"\n",
+ "linenos": false,
+ "language": "python",
+ "style": "friendly"
+ }
+]
+
+Or we can get a particular snippet by referencing its id:
+http http://127.0.0.1:8000/snippets/2/
+
+HTTP/1.1 200 OK
+...
+{
+ "id": 2,
+ "title": "",
+ "code": "print \"hello, world\"\n",
+ "linenos": false,
+ "language": "python",
+ "style": "friendly"
+}
Similarly, you can have the same json displayed by visiting these URLs in a web browser.
Where are we now
--
cgit v1.2.3