How to set up and use Python.

8LrN...xhr2
31 Jul 2026
33

Absolutely! Since you're starting from scratch, we'll build a simple API together using Python and FastAPI. This is one of the easiest and most modern ways to learn APIs.

Step 1: Install Python

Download and install Python (version 3.10 or newer) from the official Python website.

After installing, open Command Prompt (Windows) or Terminal (Mac/Linux) and type:

python --version

If you see something like:

Python 3.12.0

you're ready.


---

Step 2: Create a project folder

Create a new folder called:

MyFirstAPI

Open Command Prompt inside that folder.


---

Step 3: Install FastAPI

Run:

pip install fastapi uvicorn


---

Step 4: Create your first API

Create a file named:

main.py

Paste this code into it:

from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def home():
return {"message": "Welcome to my first API!"}

@app.get("/about")
def about():
return {"name": "Musa", "course": "Architecture"}


---

Step 5: Start the API

Run:

uvicorn main:app --reload

You should see:

Uvicorn running on http://127.0.0.1:8000


---

Step 6: Open it in your browser

Visit:

http://127.0.0.1:8000

You should see:

{
"message": "Welcome to my first API!"
}

Now visit:

http://127.0.0.1:8000/about

You'll see:

{
"name": "Musa",
"course": "Architecture"
}

Congratulations—you've just built your first API!


---

Step 7: Try the automatic documentation

FastAPI automatically creates interactive documentation.

Open:

http://127.0.0.1:8000/docs

You can test your API directly from the browser without writing any extra code.


---

Step 8: Add another endpoint

Add this below the others:

@app.get("/building")
def building():
return {
"type": "Residential",
"floors": 2,
"architect": "Musa"
}

Restart the server (or let --reload do it automatically), then visit:

http://127.0.0.1:8000/building


---

What you'll learn next

We'll build your skills in this order:

1. ✅ Create your first API (today)


2. Learn how to accept user input


3. Store data in a database


4. Connect your API to a website or mobile app


5. Add user login and authentication


6. Deploy your API so anyone on the internet can use it


7. Build a real project, such as an Architecture Project API that stores floor plans, project details, clients, and building specifications.



By the end of that journey, you'll understand how APIs work and have a portfolio project you can show to others.

BULB: The Future of Social Media in Web3

Learn more

Enjoy this blog? Subscribe to Musaddiq

0 Comments