FastApi-GeminiApi/POSTMAN_SETUP.md
2025-11-16 18:30:04 +03:30

106 lines
3.1 KiB
Markdown

# Postman Setup Guide - Step by Step
## Common Error: "Field required" for outfit_photo
This error means Postman isn't sending the file correctly. Follow these exact steps:
## ✅ Correct Setup in Postman
### Step 1: Create the Request
1. Click **New****HTTP Request**
2. Set method to **POST**
3. Enter URL: `http://localhost:8000/api/try-on/`
### Step 2: Configure Body (CRITICAL)
1. Click the **Body** tab
2. Select **form-data** (NOT raw, NOT x-www-form-urlencoded)
3. You should see a table with columns: Key | Value | Description
### Step 3: Add First File Field
1. In the **Key** column, type exactly: `user_photo`
2. Click the dropdown on the right side of that row (it will say "Text" by default)
3. Change it to **File** (NOT Text!)
4. Click **Select Files** button that appears
5. Choose your user photo image file
### Step 4: Add Second File Field
1. Click **Add Row** or just click in a new row
2. In the **Key** column, type exactly: `outfit_photo`
3. Click the dropdown on the right side (change from "Text" to **File**)
4. Click **Select Files** button
5. Choose your outfit photo image file
### Step 5: Verify Setup
Your form-data should look like this:
```
Key | Type | Value
-------------|------|----------
user_photo | File | [your file name]
outfit_photo | File | [your file name]
```
### Step 6: Send Request
- Click **Send**
- You should receive a PNG image as the response
## ❌ Common Mistakes
1. **Using "Text" instead of "File"** - This is the #1 mistake!
- Wrong: Key = `outfit_photo`, Type = Text, Value = file path
- Right: Key = `outfit_photo`, Type = File, Value = [Select Files button]
2. **Using wrong body type**
- Wrong: Body = raw (JSON)
- Wrong: Body = x-www-form-urlencoded
- Right: Body = form-data
3. **Wrong field names**
- Must be exactly: `user_photo` and `outfit_photo` (case-sensitive)
4. **Missing trailing slash**
- Wrong: `http://localhost:8000/api/try-on`
- Right: `http://localhost:8000/api/try-on/`
## Quick Test: Health Check First
Before testing try-on, verify the service is running:
1. Create a GET request
2. URL: `http://localhost:8000/health`
3. Click Send
4. Should return: `{"status": "ok"}`
If this fails, your service isn't running!
## Visual Checklist
When you look at your Postman request, you should see:
- ✅ Method: POST
- ✅ URL: `http://localhost:8000/api/try-on/`
- ✅ Body tab selected
- ✅ "form-data" radio button selected (not raw, not x-www-form-urlencoded)
- ✅ Two rows in the form-data table
- ✅ First row: Key = `user_photo`, Type = **File** (dropdown shows "File")
- ✅ Second row: Key = `outfit_photo`, Type = **File** (dropdown shows "File")
- ✅ Both rows have file names in the Value column
## Still Having Issues?
1. **Check service is running:**
```bash
# If using Docker:
docker-compose ps
# If using Python directly:
# Make sure uvicorn is running
```
2. **Check the service logs** for more details
3. **Try the FastAPI docs:**
- Open browser: `http://localhost:8000/docs`
- Use the interactive Swagger UI to test the endpoint
- This will show you exactly what the API expects