Integrated a command-line interface with an API backend by building a Flask-based service and a Python CLI client that handles auth, requests, and response formatting.
- Basic understanding of REST APIs and HTTP methods
- Familiarity with Linux command line
- Knowledge of JSON data format
- Basic Python programming skills
- Understanding of authentication concepts (tokens, API keys)
- Operating System: Ubuntu 24.04 LTS cloud lab environment
- Primary User: toor
- Python Runtime: Python 3.12.x in a virtual environment
- Service Style: Local API development and CLI/API testing workflow
- Build a command-line interface that interacts with REST APIs
- Implement authentication mechanisms in CLI applications
- Handle API responses and errors appropriately
- Parse and display JSON data in user-friendly formats
This lab was completed through the following high-level activities:
- Step 1: Create CLI Application File
- Step 2: Implement CLI Framework
- Step 3: Implement the APIClient Methods
- Step 4: Implement CLI Commands
- Step 5: Test Basic Functionality
- Step 1: Add Token Storage Functions
- Step 2: Implement Token Commands
- Step 3: Update Existing Commands
lab08-cli-and-api-integration/
├── README.md
├── commands.sh
├── output.txt
├── interview_qna.md
├── troubleshooting.md
└── project/
api_server.py
user_cli.py
- Expected: Status: healthy, Service: User API
- Expected: Table showing 3 users with ID, name, and role
- Expected: Authentication error message
- Expected: User not found message
- Expected: permissions should be
-rw-------
- How to design a CLI that communicates cleanly with REST endpoints.
- How token-based request flows should be handled in a user-facing command tool.
- How to present API responses and error cases in a readable CLI format.
- How API and CLI components evolve together as one operational workflow.
This lab has security relevance because it touches authentication handling, token usage, and safe error handling for API-driven operational tooling.
CLI-to-API integration is common in DevOps, support engineering, and platform tooling. A good command-line wrapper makes API operations faster for human operators while keeping the implementation programmable and repeatable.
- Administrative CLIs for internal services.
- Automation helpers for user and resource management APIs.
- Operational tooling used by support, platform, or security teams.
Built a working API service and companion CLI that handled health checks, authenticated requests, user retrieval, and token workflows.
This lab strengthened my hands-on foundation in cli and api integration and produced a clean set of project files, command history, execution output, interview notes, and troubleshooting guidance for portfolio use.
All code, commands, outputs, and support material used for this lab are organized in this folder for traceability and GitHub documentation readiness.