October 2016
Intermediate to advanced
418 pages
9h 52m
English
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