快速入门
在两分钟内从零开始完成您的首次数据采集。
前提条件
步骤 1:获取您的 API key
登录 Dashboard 并创建 API key。它看起来像这样:pk_live_a1b2c3d4e5f6...
复制它。每次 request 都需要使用它。
步骤 2:发送您的首次 request
打开终端并运行以下命令(将 YOUR_API_KEY 替换为您的实际 key):
curl -X POST https://eu.api.foura.ai/api/single/ \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"method": "GET", "url": "https://example.com"}'
这将向 example.com 发送一个 HTTP request,并返回页面的 HTML。
步骤 3:读取 response
{
"status": 200,
"headers": [["content-type", "text/html"]],
"data": "<!doctype html><html>...</html>",
"total_time": 0.45
}
关键字段:
status:目标网站的 HTTP 状态码data:response body(HTML、JSON 或原始文本)total_time:request 耗时(秒)
步骤 4:尝试不同的 endpoint
FourA 针对不同场景提供了三个 endpoint:
| Endpoint | 速度 | 适用场景 |
|---|---|---|
POST /api/single/ |
最快 (200ms-2s) | 静态页面、API、服务端渲染的网站 |
POST /api/browser/ |
中等 (2s-10s) | 依赖 JavaScript 的页面、SPA、动态内容 |
POST /api/proxy/ |
快 (1s-5s) | 具有机器人检测或地理限制内容的网站 |
尝试 browser request:
curl -X POST https://eu.api.foura.ai/api/browser/ \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "timeout_ms": 15000}'
尝试 proxy request(自动 proxy 轮换):
curl -X POST https://eu.api.foura.ai/api/proxy/ \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"maxTries": 3,
"request": {
"method": "GET",
"url": "https://example.com",
"unblocker": true
}
}'
后续步骤
- Authentication:API key 管理与安全
- API Endpoints:所有三个 endpoint 的完整参数参考
- SDKs and Libraries:Python、Node.js、Go、Ruby 示例
- Choosing the Right Endpoint:何时使用 single、browser 或 proxy