Skip to content

About

kpa-form-data APIs testing assignment

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

python-api-assignment

FastAPI-based API implementation for KPA Form Data assignment


KPA Form Data API Assignment – FastAPI Implementation

This project implements two endpoints from the official KPA Form Data Swagger documentation, along with an additional endpoint to demonstrate file upload capability.


Implemented Endpoints

1. POST /api/forms/bogie-checksheet

  • 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

2. GET /api/forms/wheel-specifications

  • Accepts optional query parameters:
    • formNumber
    • submittedBy
    • submittedDate
  • Reads from data/wheel_data.json
  • Returns filtered and structured data as per Postman sample

➕ Bonus Endpoint

3. POST /api/forms/upload-document

  • 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

🛠️ Tech Stack

Category Tools Used
Language Python 3.12+
Framework FastAPI
Validation Pydantic
Storage Local JSON files
Testing Swagger UI, Postman

📦 Project Setup

1. Clone the Repository

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

About

kpa-form-data APIs testing assignment

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages