§ API REFERENCE

签发报告免登 token

POST/executions/{id}/report-accessscope: reports:read

为某执行已 READY 的报告签发免登访问凭证,可选择 JSON 投影或平台托管模板页面。

鉴权:Authorization: Bearer <access_token>。
§ 1

请求信息

POST https://api.lingxiguangnian.com/api/open/v1/executions/{id}/report-access

请求头

参数类型必填说明
AuthorizationstringBearer <access_token>。由 POST /token 换取,有效期 2 小时;api_secret 不得直连业务端点(→ 401)。

路径参数

参数类型必填说明
iduuid执行 ID。

请求体参数

参数类型必填说明
delivery_modejson | hosted_view交付方式,默认 json;只影响入口,不改变报告已冻结的模板版本。
ttl_secondsnumbertoken 有效期(默认 7d,上限 30d)。
max_usesnumber最大使用次数(缺省=窗口内不限次)。
§ 2

调用示例

curl -X POST "https://api.lingxiguangnian.com/api/open/v1/executions/9b8e0c2a-3d4f-4a5b-8c6d-7e8f9a0b1c2d/report-access" \
  -H "Authorization: Bearer oat_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" -d '{ "delivery_mode": "hosted_view", "ttl_seconds": 3600 }'
§ 3

返回结果

返回字段

参数类型必填说明
access_tokenstring报告免登 token(仅此一次);JSON 模式作 Bearer 调 view-data,页面模式已置于 viewer_url 的 #fragment。
report_statusstringREADY。
access_urlstring机器消费状态端点路径,兼容保留。
content_urlstring | nulldelivery_mode=json 时的 PII-safe 内容端点。
viewer_urlstring | nulldelivery_mode=hosted_view 时的模板化报告页面;token 位于 #fragment。
{ "success": true, "data": { "report_access_token_id": "...", "access_token": "rt_xxxxxxxx", "report_id": "...", "report_kind": "item", "report_status": "READY", "expires_at": "...", "access_url": "/api/open/v1/report-access/session", "delivery_mode": "hosted_view", "content_url": null, "viewer_url": "https://api.lingxiguangnian.com/report-access/view/...#rt=rt_xxxxxxxx" } }
§ 4

端点错误码

通用鉴权、scope 与限流错误见「使用概述」;下表为本端点专属错误。

HTTPerror_code触发条件
409open_api.report_not_ready报告未生成 / 不可访问。
404open_api.execution_not_found执行不存在或不属本 APP。
使用说明
  • 报告 token 与业务 access_token 不同;不要写入日志。
  • hosted_view 使用报告生成时冻结的机构业务模板,不会在访问时重新套用机构当前默认模板。
  • viewer_url 的明文 token 位于 #fragment,不进入服务端请求路径、查询参数或 Referer。

契约真源:apps/m-master/src/app/api/open/v1/executions/[id]/report-access/route.ts