Now, we will compose and send an HTTP request to create a new game without authentication credentials:
http POST :8000/games/ name='The Last of Us' game_category='3D RPG' played=false release_date='2016-06-21T03:02:00.776594Z'
The following is the equivalent curl command:
curl -iX POST -H "Content-Type: application/json" -d '{"name":"The Last of Us", "game_category":"3D RPG", "played": "false", "release_date": "2016-06-21T03:02:00.776594Z"}' :8000/games/
We will receive a 401 Unauthorized
status code in the response header and a detail message indicating that we didn't provide authentication credentials in the JSON body. The following lines show a sample response:
HTTP/1.0 401 Unauthorized Allow: GET, POST, HEAD, OPTIONS Content-Type: application/json Date: Sun, 03 Jul 2016 22:23:07 GMT Server: WSGIServer/0.2 CPython/3.5.1 Vary: Accept, Cookie WWW-Authenticate: Basic realm="api" X-Frame-Options: SAMEORIGIN { "detail": "Authentication...