Understanding the tasks performed by each HTTP method
In the previous table, the GET
HTTP verb appears twice but with two different scopes. The first row shows a GET
HTTP verb applied to a collection of games (collection of resources) and the second row shows a GET
HTTP verb applied to a game (a single resource).
Let's assume that http://localhost:8000/games/
is the URL for the collection of games. If we add a number and a slash (/
) to the previous URL, we identify a specific game whose ID is equal to the specified numeric value. For example, http://localhost:8000/games/25/
identifies the game whose ID is equal to 25
.
We have to compose and send an HTTP request with the following HTTP verb (POST
) and request URL (http://localhost:8000/games/
) to create a new game. In addition, we have to provide the JSON (short for JavaScript Object Notation) key-value pairs with the field names and the values to create the new game. As a result of the request, the server will validate the provided values...