← Back to kitOffline reference
Experiment 12 — REST API Client + Network Commands
Manual pages: 100–104 | Tools: Python + Windows Command Prompt
AIM
To create a simple REST API client in Python and analyze performance/connectivity using Ping, Traceroute and Netstat.
PART A — REST PROGRAM & EXECUTION
- Ensure Python installed; open terminal in this folder.
python -m pip install requests(or install viarequirements.txtfrom kit root).- Run
python rest_client.py, which makes GET tohttps://jsonplaceholder.typicode.com/posts/1and prints HTTP status + JSON response. - Internet connection required; exact JSON content may change or service may be unavailable. Code includes a friendly request-error message.
PARTS B–D — WINDOWS COMMAND EXECUTION
- Open Command Prompt.
- Ping:
ping google.com→ replies and round-trip times if reachable. - Traceroute:
tracert google.com→ intermediate routers/hops (some may not respond). - Netstat:
netstatthennetstat -anthennetstat -ano→ active connections, numeric endpoints, PID. - Copy commands from WINDOWS_COMMANDS.txt.
EXPECTED OUTPUT
Status Code: 200
Response Data:
{'userId': 1, 'id': 1, 'title': '...', 'body': '...'}
PING: Reply from <IP> time=<ms>
TRACERT: hops 1, 2, 3, ...
NETSTAT: TCP/UDP endpoints; optional State and PID
RESULT
Thus, a REST API GET client was developed and network connectivity/path/connections were analyzed using Ping, Traceroute and Netstat.
VIVA
- REST APIs commonly exchange JSON over HTTP;
requests.getissues a GET request. - Ping uses ICMP; tracert shows hops; netstat displays connections/ports/PIDs.