开发者API使用说明 · 版本 v1.0
X-API-Key 和 X-API-Secret 进行身份认证。每个工具分类对应一个独立的API密钥对(App ID + App Secret)。
请求时通过HTTP Header传递:
X-API-Key: api_json_xxxxx X-API-Secret: xxxxxxxxxxxxxxxx
或通过URL参数传递(仅限GET请求):
GET /api/v1/timestamp/now?api_key=api_json_xxxxx
| 项目 | 说明 |
|---|---|
| Base URL | https://www.cnwebai.cn |
| 请求头 | Content-Type: application/json |
| 认证头 | X-API-Key + X-API-Secret |
# 请求 POST /api/v1/json/format X-API-Key: api_json_xxxxx X-API-Secret: xxxxxxxxxxxx Content-Type: application/json {"json": "{\"name\":\"test\",\"age\":25}"} # 响应 { "code": 200, "msg": "操作成功", "data": { "formatted": "{\n \"name\": \"test\",\n \"age\": 25\n}", "valid": true } }
# 请求 POST /api/v1/timestamp/convert Content-Type: application/json {"timestamp": 1715800000, "to": "date"} # 响应 { "code": 200, "data": { "timestamp": 1715800000, "date": "2024-05-16 00:26:40", "iso": "2024-05-15T16:26:40.000Z" } }
# 请求 POST /api/v1/base64/encode Content-Type: application/json {"text": "Hello World"} # 响应 { "code": 200, "data": { "encoded": "SGVsbG8gV29ybGQ=" } }
| 状态码 | 说明 |
|---|---|
| 200 | 请求成功 |
| 400 | 请求参数错误 |
| 401 | 缺少API Key或格式错误 |
| 403 | API Key无效或已停用 |
| 429 | 调用频率超限或已达每日配额 |
| 500 | 服务器内部错误 |