Client-Server Communication over HTTP
CSCI 338: Software Engineering
Fall 2025
1
Agenda
2
Outline
Understanding how to work with Web Services & APIs is so useful!
What is a Web API?
API → “Application Programming Interface”
A set of rules that you have to follow to interact with a piece of software
Web API
An API that you access via HTTP protocol. Offers a systematic way to:
REST API
A kind of Web API that honors the “REST” endpoint design conventions
5
Many Organizations Publish their Data via Web APIs
Outline
HTTP: Hypertext Transfer Protocol
Web servers communicate through HTTP – a stateless protocol for encoding, decoding, and transmitting messages over the web.
8
HTTP Methods
Methods tell the server what action they should take (verbs):
9
Method | Job | Description |
GET | Read | Retrieves / reads a resource (or container of resources) from an address (endpoint) on a server |
POST | Create | Creates a NEW resource on a server; done by posting data to an address (endpoint) on a server |
PUT | Replace | Replaces a resource on a server |
PATCH | Update | Updates a resource on a server |
DELETE | Deletes | Deletes a resource on a server |
HTTP Status Codes
Status codes provide information re: whether your request was successful. Here is a list of them. Ones you should be familiar with:
Code | Definition |
201 | POST method successfully created a resource |
200 | Valid request made (generic success message) |
400 | Client posted a bad request that the server can’t understand |
403 | Forbidden (you don’t have access to it) |
404 | Resource cannot be found |
500 | Server error (usually because there’s a server bug) |
Outline
Interacting with a Web / REST API: Clients
You can access a REST API via many different clients (including):
13
PostgreSQL
FastAPI (python service) +�SQLAlchemy �Listening on port 80 / 443
Client Machine
(phone, laptop, tablet)
Curl
Python Script
Web �Browser
Public Address, Allows Connections From Anywhere
VIEW
MODEL + CONTROLLER
DATABASE
Demo �class-exercises-fall2025/fastapi_demo
14
Sync Fork, Pull Down, Make a new Branch
15
Exercises: Python Client
16
Exercises: cURL
17
Exercises: JavaScript Client
18
Outline
Intro to Fetch
JavaScript’s Fetch API
21
What is a Promise?
Most requests happen in 2 Parts (w/2 Promises)
async function getData () {
const response = await fetch(url);
const data = await response.json();
}
Outline
Summary (1 of 2)
Summary (2 of 2)
Activity: Integration with React
27
React + Data
Set-up:
Check out the ui/src directory and take a look at the components
28