82 lines
1.7 KiB
Markdown
82 lines
1.7 KiB
Markdown
# 快速入门
|
||
|
||
## 第一步:获取 API Key
|
||
|
||
访问 https://auth.mercator.cn,创建 API Key(`mk_` 开头)。
|
||
|
||
API Key 是 Agent 与平台交互的唯一凭证。
|
||
|
||
## 第二步:浏览套件
|
||
|
||
```bash
|
||
# 列出所有套件
|
||
curl -s https://suites.mercator.cn/api/v1/suites
|
||
|
||
# 搜索套件
|
||
curl -s "https://suites.mercator.cn/api/v1/suites/search?q=缓冲区"
|
||
|
||
# 查看套件详情
|
||
curl -s https://suites.mercator.cn/api/v1/suites/{suite_id}
|
||
```
|
||
|
||
## 第三步:选择套件
|
||
|
||
从列表中筛选符合需求的套件,记录它的 `suite_id`。
|
||
|
||
## 第四步:读取参数结构
|
||
|
||
查看套件详情中的 `params_schema`,了解需要提供哪些参数:
|
||
|
||
```bash
|
||
curl -s https://suites.mercator.cn/api/v1/suites/{suite_id} | jq '.params_schema'
|
||
```
|
||
|
||
返回示例:
|
||
```json
|
||
{
|
||
"type": "object",
|
||
"required": ["buffer_distance"],
|
||
"properties": {
|
||
"buffer_distance": {
|
||
"type": "number",
|
||
"default": 0.5,
|
||
"description": "缓冲区距离(度)"
|
||
}
|
||
}
|
||
}
|
||
```
|
||
|
||
根据参数声明构造输入数据。
|
||
|
||
## 第五步:提交执行
|
||
|
||
```bash
|
||
curl -s -X POST https://suites.mercator.cn/api/v1/suites/{suite_id}/execute \
|
||
-H "Authorization: Bearer ***" \
|
||
-H "Content-Type: application/json" \
|
||
-d '{"buffer_distance": 0.5}'
|
||
```
|
||
|
||
返回结果中包含 `task_id`,用这个 ID 查询执行状态。
|
||
|
||
## 第五步:查询状态
|
||
|
||
```bash
|
||
curl -s https://suites.mercator.cn/api/v1/task/{task_id}/status
|
||
```
|
||
|
||
状态:`pending` → `running` → `completed` / `failed`
|
||
|
||
## 第六步:获取结果
|
||
|
||
任务完成后,从返回结果中读取输出数据。
|
||
|
||
## 前置条件
|
||
|
||
- **API Key**(必须)
|
||
- **GIS Actions** 在本地运行(用于实际执行任务)
|
||
|
||
## 数据安全
|
||
|
||
**数据永不离开本地。** 你的文件始终在你的机器上处理。
|