Add codeblocks for requests and responses

This commit is contained in:
Raphael Pierzina 2016-12-02 15:32:39 +00:00
parent 88738ae05c
commit 2555651794

View File

@ -169,8 +169,12 @@ We're now ready to test the API we've built. Let's fire up the server from the
We can now access our API, both from the command-line, using tools like `curl`... We can now access our API, both from the command-line, using tools like `curl`...
bash: curl -H 'Accept: application/json; indent=4' -u admin:password123 http://127.0.0.1:8000/users/ ```bash
{ curl -H 'Accept: application/json; indent=4' -u admin:password123 http://127.0.0.1:8000/users/
```
```json
{
"count": 2, "count": 2,
"next": null, "next": null,
"previous": null, "previous": null,
@ -188,15 +192,22 @@ We can now access our API, both from the command-line, using tools like `curl`..
"username": "tom" "username": "tom"
} }
] ]
} }
```
Or using the [httpie][httpie], command line tool... Or using the [httpie][httpie], command line tool...
bash: http -a admin:password123 http://127.0.0.1:8000/users/ ```bash
http -a admin:password123 http://127.0.0.1:8000/users/
```
HTTP/1.1 200 OK ```text
... HTTP/1.1 200 OK
{ ...
```
```json
{
"count": 2, "count": 2,
"next": null, "next": null,
"previous": null, "previous": null,
@ -214,8 +225,8 @@ Or using the [httpie][httpie], command line tool...
"username": "tom" "username": "tom"
} }
] ]
} }
```
Or directly through the browser, by going to the URL `http://127.0.0.1:8000/users/`... Or directly through the browser, by going to the URL `http://127.0.0.1:8000/users/`...