Overview
The Save API (running on port 3001
by default) serves as a proxy to fetch HTML content from a user-provided URL. It then forwards this HTML content to the Scan API for accessibility analysis.
The Save API (running on port 3001
by default) serves as a proxy to fetch HTML content from a user-provided URL. It then forwards this HTML content to the Scan API for accessibility analysis.
POST /
This is the primary endpoint for the Save API. It fetches content from the specified URL and sends it for scanning.
POST
application/json
{
"url": "string (The URL of the website to fetch and scan)"
}
http://
or https://
) is present, https://
is prepended to the URL.URL
constructor. This step ensures the URL has a valid hostname and that the protocol is either http
or https
.If the URL is fetched successfully and the Scan API processes the content, this endpoint will forward the JSON response directly from the Scan API. The HTTP status code will also match the Scan API's response status.
Refer to the Scan API Documentation for the structure of a successful scan result.
Status Code | Condition | Response Body Example |
---|---|---|
400 Bad Request |
URL is missing in the request body. |
|
400 Bad Request |
Invalid URL format (fails initial regex check). |
|
400 Bad Request |
Invalid URL structure or protocol (fails advanced parsing, e.g., missing hostname, non-http/https protocol after normalization). |
|
Dynamic (e.g., 404 , 500 ) |
Failed to fetch the external URL. Status code matches the external server's response. |
|
Dynamic (e.g., 400 , 500 ) |
The Scan API service returned an error. Status code matches the Scan API's response. |
|
500 Internal Server Error |
A general error occurred while processing the URL. |
|
GET /status
Provides the operational status of the Save API.
GET
200 OK
){
"status": "active",
"service": "save-api",
"timestamp": "ISO_Date_String (e.g., 2023-10-27T10:00:00.000Z)"
}
POST /set-internal-scan-mode
This endpoint is primarily for internal/development use. It allows dynamic configuration of the internal Scan API service URL that this Save API instance will communicate with.
POST
target
local
: Configures the Save API to use a local Scan API (e.g., http://localhost:3002
).server
: Configures the Save API to use the production/server Scan API (e.g., https://accessscan.sumfall.gay/api/scan
)./set-internal-scan-mode?target=local
application/json
{}
) should be sent. The server does not currently process this body content.200 OK
)When target is local
:
{
"success": true,
"message": "Save service scan target set to local."
}
When target is server
:
{
"success": true,
"message": "Save service scan target set to server."
}
400 Bad Request
)If the target
parameter is invalid or missing:
{
"success": false,
"message": "Invalid target parameter. Use \"local\" or \"server\"."
}