For the exercises below, you will need a local clone of the Learning-Resources repository at this link:
Please clone this repository to your local computer (if you have not already done so) before continuing.
The link below provides an exercise that uses the Nager.Date public Web API that we discussed in the Using APIs section:
https://github.com/HackYourFuture/Learning-Resources/tree/main/core-program/week-9/public-holidays
It consists of a pre-made web application with just one part waiting for you to complete: fetching data from the Web API. For this, you will need to study the documentation of the Nager.Date web API. Full instructions are given in the README of the example.
In this exercise, we will use a pre-made custom backend application to practice GET, POST, PUT, and DELETE requests. Visit the link below and follow the Getting started section in the README.
https://github.com/HackYourFuture/Learning-Resources/tree/main/core-program/week-9/simple-api
Exercise:
In this exercise, you will walk through a simple authentication flow using a pre-made backend and Postman.
You will:
Open the repo:
https://github.com/HackYourFuture/Learning-Resources/tree/main/core-program/week-9/auth-api
Follow the Getting Started section in the README to:
Continue once the server is running and listening on the URL and port described in the README.
In Postman, create a POST request to the Register user endpoint.
Set the request body to raw JSON, for example:
{
"username": "alice",
"password": "secret123"
}
Send the request and check that the status and JSON response match the README.
Create a POST request to the Login endpoint.
Use the same username and password in the JSON body.
Send the request. The response should contain a token field.
Copy the token value (without quotes).
The token is valid for a limited time (1 hour in this example).
401 Unauthorized response and a message like “Authorization header missing”.200 OK response and a message like “You are currently logged in as <username>”.Optionally, try requests that should fail with 4xx errors:
Pay attention to the status codes and error messages to understand how the API reports problems.

Found a mistake or have a suggestion? Let us know in the feedback form.