A command-line interface (CLI) written in C designed to interact with a RESTful web server. This project implements the HTTP protocol using Socket API, managing authentication, session persistence, and complex data orchestration.
This application serves as a bridge between a terminal interface and a virtual library server. It handles everything from low-level network communication (TCP sockets) to high-level application logic like JWT authorization and JSON data parsing.
Note on Server Availability: This client was developed to interact with a specific REST API server. As the hosting for that server is no longer active, the application currently serves as a code-base showcase for network programming, manual HTTP packet construction, and security flow implementation.
- Low-Level Networking: Built using the standard Linux Sockets API (
sys/socket.h). - Manual HTTP Implementation: Requests (GET, POST, PUT, DELETE) are constructed manually, including headers for Cookies, Content-Type, and Authorization.
- Session Management: Implements a dual-state security model using Session Cookies for initial authentication and JWT (JSON Web Tokens) for restricted library access.
- Admin & User Roles: Separate access levels for library management and regular content consumption.
- State Persistence: The client tracks session cookies and JWT tokens, automatically attaching them to the required HTTP headers for subsequent requests.
- Content Control: Full ability to add, view, update, and delete movies.
- Collection Orchestration: The
add_collectioncommand implements a complex multi-step logic, sending sequential API calls to register a title and link multiple movie IDs in a single user action.
- Translates raw HTTP status codes (400, 401, 403, 404, 500) into meaningful, user-friendly error messages.
- Client-side validation for numeric inputs (ratings, release years) to ensure data integrity before sending requests.
| Category | Commands |
|---|---|
| Identity | login, login_admin, logout, logout_admin, add_user, exit |
| Access | get_access (Requests the JWT for library operations) |
| Movies | get_movies, get_movie, add_movie, delete_movie, update_movie |
| Collections | get_collections, add_collection, delete_collection, add_movie_to_collection |
- GCC Compiler
- Linux/Unix environment (or WSL for Windows)
To compile the project using the provided Makefile:
make build
./client