Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
โ† Introduction to APIs for Data ยท Lesson 9 of 9

Module Eight

๐Ÿ“– Every lesson in this course is free to read right here, no account needed. Create a free account to track your progress, take the exam, and earn your certificate.
9
Module 8 - Building a Complete API-Powered Application
FINAL MODULE - 8 OF 8

Building a Complete API-Powered Application

Congratulations on reaching the final module of Introduction to APIs for Data!

So far, you have learned what APIs are, how they work, how to retrieve information, how to display API data, and how to protect API connections.

Now it is time to bring everything together.

In this module, you will build a simple Student Information Dashboard. The application will collect sample information from an API and display it on a webpage.

Course progress: 8 out of 8 modules (100%)

What you will learn:
  • How to plan an API-powered application.
  • How HTML, CSS, JavaScript, and APIs work together.
  • How to select an API endpoint.
  • How to retrieve and display information.
  • How to search and filter API data.
  • How to handle loading messages and errors.
  • How to test and improve your application.
  • How to plan your own API project.

1. What Is an API-Powered Application?

An API-powered application is a website or software that uses an API to obtain or exchange information with another system.

For example, imagine that you are using a school website to check examination results.

The website may not store all the information directly on the page. Instead, it requests the information from a server through an API.

The server sends the information back, and the website displays it.

Everyday examples of API-powered applications:
  • A weather application that retrieves weather information.
  • A school portal that displays examination results.
  • An online store that displays available products.
  • A learning platform that displays courses.
  • A banking application that retrieves account information.

2. Understanding the Parts of an API-Powered Application

A simple web application may use four important technologies:

Technology What It Does
HTML Creates the structure of the webpage.
CSS Controls the appearance and design.
JavaScript Makes the webpage interactive and communicates with the API.
API Provides information or performs operations on a server.

Think of building a house:

  • HTML is like the building structure.
  • CSS is like the paint and decoration.
  • JavaScript is like the electrical system that makes things work.
  • The API is like a service connection that provides information from another location.

3. Planning Our Final Project

We will build a Student Information Dashboard for an imaginary secondary school in Ibadan.

The dashboard will display sample user information from a public testing API.

It will include:

  • A dashboard heading.
  • A button to load student records.
  • A list of sample student information.
  • A search box.
  • A loading message.
  • An error message when something goes wrong.
Our project goal:

Build a webpage that requests sample records from an API and allows users to search through the returned information.

4. Choosing an API

Before building an API-powered application, you need to choose an API that provides the information your application requires.

For this project, we will use JSONPlaceholder.

JSONPlaceholder is a public testing API that provides sample information for developers and learners.

Our API endpoint:

https://jsonplaceholder.typicode.com/users

This endpoint returns a list of sample users.

We will use the returned names, email addresses, and addresses as pretend student information.

Important: The records from JSONPlaceholder are sample data. They are not real students and should not be treated as actual school records.

5. Understanding Our Application Workflow

Before writing code, let's understand how our application will work.

  1. The user opens the webpage.
  2. The webpage displays a dashboard.
  3. The user clicks the Load Students button.
  4. JavaScript sends a GET request to the API.
  5. The API returns sample user information in JSON format.
  6. JavaScript reads the information.
  7. The information is displayed on the webpage.
  8. The user can search for a particular name.

Application Workflow Diagram


USER OPENS WEBPAGE
        |
        v
STUDENT DASHBOARD
        |
        v
USER CLICKS LOAD STUDENTS
        |
        v
JAVASCRIPT SENDS API REQUEST
        |
        v
API SERVER PROCESSES REQUEST
        |
        v
SERVER RETURNS JSON DATA
        |
        v
JAVASCRIPT PROCESSES DATA
        |
        v
STUDENT RECORDS DISPLAYED
        |
        v
USER CAN SEARCH RECORDS

6. Building the Student Information Dashboard

Now let's build the complete application.

We will write the HTML, CSS, and JavaScript in one file to make the project easier for beginners.

Complete Project Code

<!DOCTYPE html>
<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport"
content="width=device-width, initial-scale=1.0">

<title>Student Information Dashboard</title>

<style>

body {
    margin: 0;
    padding: 20px;
    }

.container {
    max-width: 850px;
    margin: auto;
    padding: 25px;
    border-radius: 12px;
}

h1 {
    }

button {
    border: none;
    padding: 12px 18px;
    border-radius: 6px;
    cursor: pointer;
}

button:hover {
    }

input {
    width: 100%;
    padding: 12px;
    margin: 15px 0;
    border: 1px solid #ccc;
    border-radius: 6px;
}

.student {
    padding: 15px;
    margin-bottom: 12px;
    border-radius: 8px;
}

.student h3 {
    }

.message {
    margin: 15px 0;
    }

.error {
    }

</style>

</head>

<body>

<div class="container">

    <h1>Student Information Dashboard</h1>

    <p>
        Welcome to the student information dashboard.
        Click the button below to load sample records.
    </p>

    <button id="loadButton">
        Load Students
    </button>

    <input
        type="text"
        id="searchBox"
        placeholder="Search by student name..."
        disabled
    >

    <div id="message" class="message"></div>

    <div id="students"></div>

</div>

<script>

let allStudents = [];

const loadButton =
    document.getElementById("loadButton");

const searchBox =
    document.getElementById("searchBox");

const message =
    document.getElementById("message");

const studentContainer =
    document.getElementById("students");


async function loadStudents() {

    message.textContent = "Loading student records...";
    message.className = "message";

    studentContainer.replaceChildren();

    loadButton.disabled = true;

    try {

        const response = await fetch(
            "https://jsonplaceholder.typicode.com/users"
        );

        if (!response.ok) {
            throw new Error("Unable to retrieve records.");
        }

        const data = await response.json();

        allStudents = data;

        displayStudents(allStudents);

        message.textContent =
            allStudents.length + " sample records loaded.";

        searchBox.disabled = false;

    } catch (error) {

        message.textContent =
            "Something went wrong: " + error.message;

        message.className = "message error";

    } finally {

        loadButton.disabled = false;

    }
}


function displayStudents(students) {

    studentContainer.replaceChildren();

    if (students.length === 0) {

        message.textContent = "No matching records found.";

        return;

    }

    students.forEach(student => {

        const card = document.createElement("div");

        card.className = "student";

        const heading = document.createElement("h3");

        heading.textContent = student.name;

        const email = document.createElement("p");

        email.textContent =
            "Email: " + student.email;

        const city = document.createElement("p");

        city.textContent =
            "City: " + student.address.city;

        card.appendChild(heading);

        card.appendChild(email);

        card.appendChild(city);

        studentContainer.appendChild(card);

    });

}


searchBox.addEventListener("input", function() {

    const searchTerm =
        searchBox.value.toLowerCase().trim();

    const filteredStudents = allStudents.filter(student =>

        student.name.toLowerCase().includes(searchTerm)

    );

    displayStudents(filteredStudents);

});


loadButton.addEventListener("click", loadStudents);

</script>

</body>

</html>

7. Understanding the Project Code

Let's understand the important parts of the application.

A. Creating the HTML Structure

<h1>Student Information Dashboard</h1>

<button id="loadButton">
    Load Students
</button>

<div id="students"></div>

This creates the heading, button, and area where student records will appear.

B. Connecting to the API

const response = await fetch(
    "https://jsonplaceholder.typicode.com/users"
);

This sends a request to the public API.

C. Reading the API Response

const data = await response.json();

This reads the JSON response and converts it into JavaScript data.

D. Saving the Information

allStudents = data;

The returned information is saved inside the allStudents variable so that the application can use it later.

E. Displaying Student Records

displayStudents(allStudents);

This sends the information to the function responsible for displaying the records.

F. Searching Student Records

const filteredStudents = allStudents.filter(student =>

    student.name.toLowerCase().includes(searchTerm)

);

This checks the names and returns only the records that match the search.

8. How to Test Your Application

Follow these steps:

  1. Open a text editor such as Notepad or Visual Studio Code.
  2. Copy the complete project code.
  3. Save the file as student-dashboard.html.
  4. Open the file using a modern web browser.
  5. Make sure your internet connection is working.
  6. Click the Load Students button.
  7. Wait for the sample records to appear.
  8. Type a name into the search box.
  9. Observe how the displayed records change.
Expected result:

You should see sample names, email addresses, and cities displayed on the webpage.

You should also be able to search for names and display matching records.

9. Improving Your Application

A good developer does not stop after making an application work. They also look for ways to improve it.

Here are some features you can add:

  • Add a button to clear the search box.
  • Display the total number of records.
  • Add a refresh button.
  • Improve the design for mobile phones.
  • Add a message when no records are found.
  • Allow users to sort records alphabetically.
  • Add a separate page for viewing one record.

10. Testing and Troubleshooting

Testing means checking whether your application works as expected.

Problem What to Check
Nothing appears Check your internet connection and browser console.
API request fails Check the endpoint and server response.
Search does not work Check the search event and filter function.
Information is missing Check the JSON property names and response structure.
Page looks untidy Review your CSS and HTML structure.

Using the Browser Console

The browser console helps developers find errors.

In most desktop browsers, you can open developer tools by pressing F12 and selecting the Console tab.

You may see messages such as:

Failed to fetch
404 Not Found
TypeError

These messages can help you understand what went wrong.

11. Understanding the Difference Between a Demo and a Real Application

The application we built is a learning project. It retrieves sample information from a public testing API.

A real school management system would need more features.

Learning Project Real School Application
Uses sample records. Uses authorised school records.
Displays information. May allow authorised users to manage information.
Does not require a private login. Requires secure authentication.
Does not store real student records. Needs a properly protected database.
Uses a public testing API. Uses a controlled API with permissions and security checks.
Important: Never use a public testing API to store real student information, examination results, passwords, or private school records.

12. Your Final Project Challenge

You have now built a Student Information Dashboard. It is time to design your own API-powered application.

Choose one of the following project ideas:

Project A: School Course Directory

  • Display a list of courses.
  • Show course descriptions.
  • Allow learners to search for courses.
  • Display the total number of courses.

Project B: Weather Information Dashboard

  • Connect to a suitable weather API.
  • Allow users to enter a city.
  • Display the weather information returned by the API.
  • Handle incorrect city names and API errors.

Project C: Digital Library

  • Display a list of books.
  • Show book titles and authors.
  • Allow users to search for books.
  • Display a message when no matching books are found.

Project D: Student Results Dashboard

  • Design a student results interface.
  • Display sample examination records.
  • Allow searching by student name.
  • Show examination scores.
  • Explain how you would protect real student records.

13. Final Project Submission Checklist

Before submitting your project, check the following:

  • My application has a clear title.
  • My application uses HTML correctly.
  • My application has a CSS design.
  • My application uses JavaScript.
  • My application connects to a working API.
  • My application can receive and process JSON data.
  • My application displays information correctly.
  • My application handles loading messages.
  • My application handles errors.
  • My application has a useful search or filter feature.
  • I have considered the security of private information.

14. Final Knowledge Assessment

You have reached the final assessment for Introduction to APIs for Data. Choose the correct answer for each question.

Question 1:

What is an API-powered application?




Question 2:

Which technology provides the structure of a webpage?




Question 3:

Which technology controls the appearance of a webpage?




Question 4:

Which technology can make an API request from a webpage?




Question 5:

Which JavaScript function can request data from an API?




Question 6:

Why do developers use response.json()?




Question 7:

Which method can help search through an array?




Question 8:

What is the purpose of a loading message?




Question 9:

Why should a real school application use authentication and authorization?




Question 10:

What should you do when an API request fails?




15. Final Course Recap

Let's review everything you have learned across the eight modules.

Module Topic
1 Introduction to APIs and Data
2 How APIs Work - Requests, Responses and Endpoints
3 Understanding HTTP Methods and Status Codes
4 Introduction to JSON and XML Data Formats
5 Working with REST APIs and API Documentation
6 Working with API Data Using JavaScript
7 API Security, Authentication and Data Protection
8 Building a Complete API-Powered Application

16. What Can You Do Now?

After completing this course and practising the exercises, you should be able to:

  • Explain what an API is.
  • Understand how applications communicate with servers.
  • Recognise API endpoints and HTTP methods.
  • Understand JSON and XML data.
  • Read basic API documentation.
  • Retrieve API information using JavaScript.
  • Display and search API data.
  • Understand basic API security principles.
  • Build a simple API-powered webpage.
Final message:

You do not need to know everything about programming before you start working with APIs. The best way to improve is to keep practising, building small projects, and learning from your mistakes.

Every great developer started as a beginner.

Congratulations! You Have Completed the Course

You have successfully reached the end of Introduction to APIs for Data.

Keep practising the projects and exercises. Try connecting different APIs and building applications that solve real problems.

Your next challenge:

Build an application that retrieves information from an API, displays the information, and allows users to interact with it.

Do not just learn how APIs work. Use them to build something useful!

Course Completion

Course: Introduction to APIs for Data

Modules: 8

Final Project: API-Powered Application

Platform: CRMNuggets

CRMNuggets

Learn. Practice. Get Certified.

๐Ÿ† Get Certified

๐Ÿ”’

Earn this certificate

Every lesson is already free to read. Sign up, finish the lessons, pass the exam (โ‚ฆ2,000 or 20,000 coins), and get a verified certificate with your name on it.

๐ŸŽ“ Sign Up to Get Certified
๐Ÿ› ๏ธ Practice Tools
Hands-on simulators & labs - subscription required.
โ†’
๐ŸŽฏ Internship Tasks
Real-world tasks to build your portfolio - unlock them with a subscription.
โ†’