API 参考 / attachments
GET /api/v1/attachments · listAttachments
按当前项目 RLS 读取某个目标对象(targetType+targetId)的附件元数据列表;只返回元数据 (文件名/大小/mime/上传者/时间),不返回文件本体。targetType 只接受白名单内的值 (requirement / work_item / bug / milestone / document / comment),其余返回 422——不返回空列表, 免得参数写错被当成「这个对象没有附件」。targetType=work_item 且 targetId 指向的工作项 type=bug 时,服务端按 bug 查(与上传侧同一条归一规则,B-00065),不会回一个空列表。 评论附件(B-00080):targetType=comment + targetId=评论 uuid 列出挂在这条评论上的附件; 讨论区可用逗号分隔的多值 targetId 一次取回整屏评论的附件(B-00090), 评论附件不会出现在宿主对象的附件列表里(宿主的附件列表仍按 requirement / bug / work_item 等自己的 targetType 查)。
多值语义:limit 作用在每个 targetId 上(不是总条数),这样一条评论的附件不会因为 前面几条占满配额而整条消失;某个 targetId 没有附件时它就不出现在结果里——响应里 每条 Attachment 都带 targetId,调用方按 id 分组后取不到即为空,不存在歧义。
鉴权:项目 API Token(Authorization: Bearer wfp_…)。详见 Agent 接入。
targetType(必填)targetId(必填)limititems(必填)items[].id(必填)items[].targetType(必填)items[].targetId(必填)items[].fileName(必填)items[].size(必填)items[].mimeType(必填)items[].uploaderId(必填)items[].createdAt(必填)403:Problem 错误响应422:Problem 错误响应curl -X GET "https://你的项目.workflow.games/api/v1/attachments?targetType=…&targetId=…" \
-H "Authorization: Bearer wfp_…"HTTP/1.1 200
{
"items": [
{
"id": "018f3c2e-0000-7000-8000-000000000000",
"targetType": "requirement",
"targetId": "018f3c2e-0000-7000-8000-000000000000",
"fileName": "示例标题",
"size": 1,
"mimeType": "示例文本",
"uploaderId": "018f3c2e-0000-7000-8000-000000000000",
"createdAt": "示例文本"
}
]
}合同真值:OpenAPI 3.1(0.1.0)。
相关:Agent 接入指南 · 使用指南 · API 参考索引