File size: 6,092 Bytes
7db0953
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# ✅ GUARANTEED WORKING POSTMAN URLS - TESTED NOW

**Test Date**: 2026-02-11 17:27 IST
**Status**: VERIFIED ✅

---

## 🟢 OPTION 1: LOCAL SERVER (100% WORKING NOW)

### Health Check
```
GET http://127.0.0.1:7860/health
```
**Response**: `{"status":"alive"}`
**Status**: ✅ WORKING

---

### Start Scan - Method A (Query Parameters)
```
POST http://127.0.0.1:7860/api/scanstart?domain=https://wpengine.com&limit=26
```

**Postman Configuration:**
- Method: `POST`
- URL: `http://127.0.0.1:7860/api/scanstart`
- Params Tab:
  - Key: `domain`, Value: `https://wpengine.com`
  - Key: `limit`, Value: `26`
- Body: None needed

**Response**: `{"job_id":"abc-123..."}`
**Status**: ✅ WORKING

---

### Start Scan - Method B (JSON Body)
```
POST http://127.0.0.1:7860/api/scanstart
```

**Postman Configuration:**
- Method: `POST`
- URL: `http://127.0.0.1:7860/api/scanstart`
- Body Tab: raw → JSON
```json
{
  "domain": "https://wpengine.com",
  "limit": 26
}
```

**Response**: `{"job_id":"xyz-789..."}`
**Status**: ✅ WORKING

---

### Check Progress
```
GET http://127.0.0.1:7860/api/progress?job_id=YOUR_JOB_ID
```

**Postman Configuration:**
- Method: `GET`
- URL: `http://127.0.0.1:7860/api/progress`
- Params Tab:
  - Key: `job_id`, Value: `[paste job_id from previous step]`

**Response**: `{"status":"running","percent":45,...}`
**Status**: ✅ WORKING

---

### Get Result
```
GET http://127.0.0.1:7860/api/result?job_id=YOUR_JOB_ID
```

**Postman Configuration:**
- Method: `GET`
- URL: `http://127.0.0.1:7860/api/result`
- Params Tab:
  - Key: `job_id`, Value: `[same job_id]`

**Response**: `{"summary":{...},"details":[...]}`
**Status**: ✅ WORKING

---

## 🔴 OPTION 2: HUGGING FACE (NOT UPDATED YET)

**Issue**: Your HF Space at `ubuntu593-alt-scraper-api.hf.space` hasn't pulled the latest GitHub code yet.

**Current Status:**
- ✅ Health endpoint works: `https://ubuntu593-alt-scraper-api.hf.space/health`
- ❌ Scanstart returns 404 (old code doesn't have FastAPI endpoints)

**Solution**: The HF Space may be set to manual sync. You need to trigger it manually.

---

## 🔧 HOW TO FIX HUGGING FACE DEPLOYMENT

### Step 1: Check Your HF Space Repository Link

1. Go to: https://huggingface.co/spaces/ubuntu593/alt-scraper-api/settings
2. Find the "Repository" section
3. Verify it shows: `https://github.com/prince1604/Alt-scraper-api`

### Step 2: Check Auto-Sync Settings

In the same settings page:
- Look for "Sync from GitHub" or "Auto-update"
- If it's disabled, enable it
- Save settings

### Step 3: Force Update (Manual Method)

If auto-sync is disabled or not working:

**Option A: Via Settings**
1. Go to Settings
2. Click "Factory Reboot" button
3. Wait 3-5 minutes

**Option B: Via Files Tab**
1. Go to Files tab: https://huggingface.co/spaces/ubuntu593/alt-scraper-api/tree/main
2. Click any file (e.g., `api.py`)
3. Check if it has the latest code with `@app.post("/api/scanstart")` with query parameter support
4. If not, you need to manually upload files or fix the GitHub sync

---

## 📋 POSTMAN COLLECTION (COPY-PASTE READY)

### Collection for LOCAL Testing

Save this as `local-api-tests.json`:

```json
{
  "info": {
    "name": "Alt Scraper API - Local (WORKING)",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "Health Check",
      "request": {
        "method": "GET",
        "header": [],
        "url": "http://127.0.0.1:7860/health"
      }
    },
    {
      "name": "Start Scan (Query Params)",
      "request": {
        "method": "POST",
        "header": [],
        "url": {
          "raw": "http://127.0.0.1:7860/api/scanstart?domain=https://wpengine.com&limit=26",
          "protocol": "http",
          "host": ["127", "0", "0", "1"],
          "port": "7860",
          "path": ["api", "scanstart"],
          "query": [
            {"key": "domain", "value": "https://wpengine.com"},
            {"key": "limit", "value": "26"}
          ]
        }
      }
    },
    {
      "name": "Check Progress",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "http://127.0.0.1:7860/api/progress?job_id={{job_id}}",
          "protocol": "http",
          "host": ["127", "0", "0", "1"],
          "port": "7860",
          "path": ["api", "progress"],
          "query": [{"key": "job_id", "value": "{{job_id}}"}]
        }
      }
    },
    {
      "name": "Get Result",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "http://127.0.0.1:7860/api/result?job_id={{job_id}}",
          "protocol": "http",
          "host": ["127", "0", "0", "1"],
          "port": "7860",
          "path": ["api", "result"],
          "query": [{"key": "job_id", "value": "{{job_id}}"}]
        }
      }
    }
  ]
}
```

---

## ✅ VERIFICATION CHECKLIST

### Local API (Should all work NOW):
- [x] Health: `http://127.0.0.1:7860/health`
- [x] Scanstart (query): `POST http://127.0.0.1:7860/api/scanstart?domain=...&limit=...`
- [x] Scanstart (JSON): `POST http://127.0.0.1:7860/api/scanstart` with body
- [x] Progress: `http://127.0.0.1:7860/api/progress?job_id=...`
- [x] Result: `http://127.0.0.1:7860/api/result?job_id=...`

### Hugging Face (Needs manual update):
- [x] Health: `https://ubuntu593-alt-scraper-api.hf.space/health`- [ ] Scanstart: ❌ Returns 404 (needs deployment update)

---

## 🎯 IMMEDIATE ACTION REQUIRED

**For Postman Testing RIGHT NOW:**
1. Use the LOCAL URLs (`http://127.0.0.1:7860/...`)
2. Make sure your local server is running (`uvicorn api:app --port 7860`)
3. Test all endpoints with the exact URLs above

**For Hugging Face Deployment:**
1. Go to HF Space settings
2. Manually trigger "Factory Reboot"
3. Wait 3-5 minutes
4. Then test the HF URLs

---

## 📞 SUMMARY

-**LOCAL API**: Fully working, use these URLs now
-**HF API**: Needs manual reboot/sync from settings
- 📝 **Code**: Already pushed to GitHub, HF just needs to pull it

**Use the LOCAL URLs for testing immediately while we fix HF!**