File size: 3,071 Bytes
3176f9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Antigravity SEO Scaler - API Documentation

Base URL: `http://localhost:7860` (or your deployed URL)

## 1. Start a New Scan
Initiates an asynchronous crawling and analysis job for a target domain.

- **Endpoint**: `/api/scanstart`
- **Method**: `POST`
- **Headers**: `Content-Type: application/json`
- **Body Parameters**:
    - `domain` (string, required): The URL of the website to scan (e.g., "https://example.com").
    - `limit` (integer, optional): Maximum number of pages to crawl. Default is `25`.

**Example Request (curl):**
```bash
curl -X POST "http://localhost:7860/api/scanstart" \
     -H "Content-Type: application/json" \
     -d '{"domain": "https://example.com", "limit": 50}'
```

**Example Response:**
```json
{
  "job_id": "8e8c40c5-77e0-4ad6-906a-53d038cd9fe7"
}
```

---

## 2. Check Scan Progress
Retrieves the real-time status of a running job. You can use either a path parameter or a query parameter.

### Option A: Path Parameter
- **Endpoint**: `/api/progress/{job_id}`
- **Method**: `GET`

### Option B: Query Parameter
- **Endpoint**: `/api/progress`
- **Method**: `GET`
- **Query Parameters**:
    - `job_id` (string, required): The ID returned by the start endpoint.

**Example Request:**
```bash
curl "http://localhost:7860/api/progress/8e8c40c5-77e0-4ad6-906a-53d038cd9fe7"
# OR
curl "http://localhost:7860/api/progress?job_id=8e8c40c5-77e0-4ad6-906a-53d038cd9fe7"
```

**Example Response:**
```json
{
  "status": "running",
  "percent": 45,
  "pages_scanned": 12,
  "images_found": 86,
  "message": "Scanning: https://example.com/about",
  "elapsed_seconds": 15,
  "eta_seconds": 20,
  "error": null
}
```
*Possible Statuses*: `pending`, `running`, `done`, `error`

---

## 3. Get Scan Results
Retrieves the final detailed JSON report. This should be called when the progress status is `done`.

### Option A: Path Parameter
- **Endpoint**: `/api/result/{job_id}`
- **Method**: `GET`

### Option B: Query Parameter
- **Endpoint**: `/api/result`
- **Method**: `GET`
- **Query Parameters**:
    - `job_id` (string, required): The ID of the completed job.

**Example Request:**
```bash
curl "http://localhost:7860/api/result/8e8c40c5-77e0-4ad6-906a-53d038cd9fe7"
```

**Example Response:**
```json
{
  "summary": {
    "total_pages_scanned": 50,
    "total_images_found": 320,
    "total_images_missing_alt": 45,
    "blocked_reason": null,
    "crawl_blocked": false
  },
  "details": [
    {
      "page_url": "https://example.com",
      "images": [ ... ]
    }
  ]
}
```

---

## 4. System Status
Checks the health and resource usage of the underlying server.

- **Endpoint**: `/api/status`
- **Method**: `GET`
- **Query Parameters**:
    - `domain` (string, optional): A target URL to check reachability for.

**Example Response:**
```json
{
  "cpu_percent": 12.5,
  "memory_percent": 45.2,
  "disk_usage": 60.1,
  "target_reachable": true
}
```

---

## 5. Health Check
Simple endpoint for load balancers or uptime monitors.

- **Endpoint**: `/health`
- **Method**: `GET`

**Example Response:**
```json
{ "status": "alive" }
```