SKILL.md 1.83 KB

name: l1-api-request description: "L1 原子技能:通用 REST API 调用。支持 GET/POST/PUT/DELETE,自定义 Headers 和 Body。" layer: 1 domain: tooling keywords:

  • api
  • rest
  • http
  • request
  • get
  • post input_schema: "{ url: string, method: string, headers?: object, body?: object }" output_schema: "{ status: number, body: string, headers: object }" ---

L1: API Request(通用 API 调用原子技能)

能力

向任意 REST API 发送 HTTP 请求,支持所有标准方法和自定义头部。

使用方法

GET 请求

curl -s -X GET "<URL>" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <TOKEN>"

POST 请求(JSON Body)

curl -s -X POST "<URL>" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <TOKEN>" \
  -d '{"key": "value"}'

PUT 请求

curl -s -X PUT "<URL>" \
  -H "Content-Type: application/json" \
  -d '{"key": "updated_value"}'

DELETE 请求

curl -s -X DELETE "<URL>" \
  -H "Authorization: Bearer <TOKEN>"

带完整响应信息

curl -s -w "\n---HTTP_STATUS:%{http_code}---" -X GET "<URL>" \
  -H "Accept: application/json"

格式化 JSON 输出

curl -s "<URL>" | python3 -m json.tool

输入

参数 类型 必填 说明
url string ✅ 目标 API URL
method string ✅ HTTP 方法: GET/POST/PUT/DELETE/PATCH
headers object ❌ 自定义请求头
body object ❌ 请求体(POST/PUT/PATCH 时)

输出

字段 说明
status HTTP 状态码
body 响应体内容

约束

  • 超时:15 秒
  • 不自动追踪重定向(需要时加 -L)
  • 敏感信息(API Key、Token)不应硬编码,从环境变量读取
  • 响应体截取前 5000 字符