FastAPI-based API implementation for KPA Form Data assignment
This project implements two endpoints from the official KPA Form Data Swagger documentation, along with an additional endpoint to demonstrate file upload capability.
- Accepts bogie inspection form data in JSON format
- Validates nested data using Pydantic
- Saves data to
data/bogie_data.json - Returns a success message with submitted metadata
- Accepts optional query parameters:
formNumbersubmittedBysubmittedDate
- Reads from
data/wheel_data.json - Returns filtered and structured data as per Postman sample
- Accepts file uploads via
multipart/form-data - Supports PDF, images, and other document types
- Saves files to
app/uploads/ - Responds with file name and content type
| Category | Tools Used |
|---|---|
| Language | Python 3.12+ |
| Framework | FastAPI |
| Validation | Pydantic |
| Storage | Local JSON files |
| Testing | Swagger UI, Postman |
git clone https://github.com/SHATAKSHI26-UI/python-api-assignment.git
cd python-api-assignment
### 2. Set Up Virtual Environment
```bash
python -m venv venv
**Activate it:**
- **On Windows:**
```bash
venv\Scripts\activate
**On macOS/Linux:**
```bash
source venv\Scripts\activate
### 3. Install FastAPI and Dependencies
```bash
pip install fastapi uvicorn pydantic python-multipart
### 4. Save Installed Packages to requirements.txt
```bash
pip freeze > requirements.txt
### 5. Run the Server
```bash
uvicorn main:app --reload
**Then open your browser at:**
http://127.0.0.1:8000/docs