aboutsummaryrefslogtreecommitdiffstats
path: root/docs/tutorial/4-authentication-and-permissions.md
diff options
context:
space:
mode:
authorTom Christie2014-12-08 15:51:19 +0000
committerTom Christie2014-12-08 15:51:19 +0000
commit302ec59a5c8b97b5d6be1e50e16a33df51508a81 (patch)
treee838d159f8b04f45a28b106907fdb4fee31d38b6 /docs/tutorial/4-authentication-and-permissions.md
parentfd02d8266b3df2a5ed41f599eae6765631643da2 (diff)
parentf3ebac061e7b5a67afe1d9440876afa804d3995d (diff)
downloaddjango-rest-framework-302ec59a5c8b97b5d6be1e50e16a33df51508a81.tar.bz2
Merge pull request #2165 from phalt/httpie-examples
Use httpie for tutorials
Diffstat (limited to 'docs/tutorial/4-authentication-and-permissions.md')
-rw-r--r--docs/tutorial/4-authentication-and-permissions.md20
1 files changed, 15 insertions, 5 deletions
diff --git a/docs/tutorial/4-authentication-and-permissions.md b/docs/tutorial/4-authentication-and-permissions.md
index 43c1953e..a6d27bf7 100644
--- a/docs/tutorial/4-authentication-and-permissions.md
+++ b/docs/tutorial/4-authentication-and-permissions.md
@@ -198,15 +198,25 @@ If we're interacting with the API programmatically we need to explicitly provide
If we try to create a snippet without authenticating, we'll get an error:
- curl -i -X POST http://127.0.0.1:8000/snippets/ -d "code=print 123"
+ http POST http://127.0.0.1:8000/snippets/ code="print 123"
- {"detail": "Authentication credentials were not provided."}
+ {
+ "detail": "Authentication credentials were not provided."
+ }
We can make a successful request by including the username and password of one of the users we created earlier.
- curl -X POST http://127.0.0.1:8000/snippets/ -d "code=print 789" -u tom:password
-
- {"id": 5, "owner": "tom", "title": "foo", "code": "print 789", "linenos": false, "language": "python", "style": "friendly"}
+ http POST -a tom:password http://127.0.0.1:8000/snippets/ code="print 789"
+
+ {
+ "id": 5,
+ "owner": "tom",
+ "title": "foo",
+ "code": "print 789",
+ "linenos": false,
+ "language": "python",
+ "style": "friendly"
+ }
## Summary