跳转到主要内容

Get widget

获取小部件

GET /v1/widgets/id

operationId: getWidget · 分组: Widgets · 鉴权: Bearer Token

按 ID 返回单个小部件。路径参数 id 为资源主键;响应体字段以本文示例为准(可替换为你的 OAS 示例)。

Path 参数

名称位置类型必填说明
id path string 必填 小部件 ID
Header 参数
名称位置类型必填说明
Authorization header string 必填 Bearer <token>
请求示例
curl(静态示例;本页无试调表单)
curl -sS 'https://api.example.com/v1/widgets/wdg_42' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json'
fetch
fetch('https://api.example.com/v1/widgets/wdg_42', {
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Accept': 'application/json'
  }
}).then(r => r.json())

响应

200 成功

application/json
{
  "id": "wdg_42",
  "name": "Demo Widget",
  "status": "active",
  "updated_at": "2026-11-02T08:00:00Z"
}

404 未找到

ID 不存在或不在当前鉴权范围。

{
  "error": {
    "code": 404,
    "message": "Widget not found"
  }
}