Skip to content

A JavaScript practice project demonstrating API usage with Axios. Fetches fake user details, random dog images, and college data using query parameters. Includes async/await handling, dynamic DOM updates, and clean UI structure for learning modern JS concepts.

Notifications You must be signed in to change notification settings

shanusingh01/js-api-practice-suite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

js-api-practice-suite

A collection of small JavaScript projects demonstrating how to interact with public APIs using Axios. This suite includes three separate features: fetching fake user data, generating random dog images, and searching universities by country. It serves as a practical hands-on learning project for mastering API requests, async/await, DOM manipulation, and error handling in JavaScript.


πŸ“Œ Features Overview

πŸ”Ή 1. Fake User Information (RandomUser API)

Fetches a random fake user profile including:

  • Name
  • Gender
  • Email
  • Address
  • Additional personal details

The details are displayed in JSON format inside the webpage.

πŸ”Ή 2. Random Dog Images (Dog CEO API)

Displays a random dog image with each button click.
Uses Axios to retrieve image URLs and updates the DOM instantly.

πŸ”Ή 3. College Finder by Country (Hipolabs Universities API)

Enter any country name to retrieve a list of universities.
Useful for understanding:

  • Query string API requests
  • Rendering dynamic lists
  • Handling API errors gracefully

πŸ› οΈ Tech Stack

Frontend:

  • HTML
  • CSS
  • Vanilla JavaScript

Networking:

  • Axios (CDN version)

APIs Used:

  • RandomUser API
  • Dog CEO API
  • Hipolabs Universities API

πŸ“‚ Project Structure

  • index.html – Page layout and UI
  • style.css – Minimal styling
  • json.js – All API logic and event handling

πŸš€ How to Use

⭐ Fake User Generator

  1. Click Show the details
  2. A random fake user profile is fetched and displayed

⭐ Random Dog Image

  1. Click show
  2. A new dog image appears on the screen

⭐ College Finder

  1. Enter a country (e.g., "Canada", "India", "Australia")
  2. Click search
  3. A list of universities loads below

🎯 Concepts Practiced

  • Making GET requests using Axios
  • Understanding async/await
  • Handling errors with try/catch
  • Working with query parameters
  • Updating DOM elements dynamically
  • Rendering JSON responses on screen
  • Creating reusable asynchronous functions

🧠 What I Learned

  • How to fetch data from APIs efficiently
  • How to debug API errors
  • How to update UI elements using JavaScript
  • How to format JSON output for readability
  • How multiple APIs can be combined into one project

πŸ“œ License

This project is for learning and practice purposes.
You may use or modify it freely.

About

A JavaScript practice project demonstrating API usage with Axios. Fetches fake user details, random dog images, and college data using query parameters. Includes async/await handling, dynamic DOM updates, and clean UI structure for learning modern JS concepts.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published