单据附件添加

  • 接口:common/document/addAttachments
  • Method:POST
  • 数据格式:JSON
  • 接口说明:单据附件添加
  • 其他补充信息:
    • documentNumexternalId必填其一
    • 只能添加附件, 不能删除/修改附件
    • 支持添加单据头附件、普通单据行附件、事项明细行附件
    • 普通单据行附件需传 claim_lines[].line_id
    • 事项明细行附件需传 custom_line[].id
    • 仅处理未带附件 ID 的附件数据;已有附件 ID 的数据会被忽略

请求参数

字段名称 字段类型 字段描述 是否必填 长度
externalId String 外部系统单据号或云简系统单据号 ONE-OF 64

请求数据

?externalId=8000252981

body

字段名称 字段类型 字段描述 是否必填 长度限制(字节)
bizId String 当前次接口同步的唯一标识 TRUE 36
timestamp Long 当前次接口同步的时间戳 TRUE 13
data Object 请求数据体 TRUE
data.attachments Object 单据头附件栏位 FALSE
data.attachments.file_name String 文件名 FALSE 255
data.attachments.attachment_url String 文件地址 (需提前调用文件上传标准口上传文件,贴上传结果中的文件地址) FALSE
data.attachments.attachment_type_code String 附件类型编码 FALSE
data.attachments1 Object 单据头附件栏位 FALSE
data.attachments1.file_name String 文件名 FALSE 255
data.attachments1.attachment_url String 文件地址 (需提前调用文件上传标准口上传文件,贴上传结果中的文件地址) FALSE
data.attachments1.attachment_type_code String 附件类型编码 FALSE
data.attachments50 Object 单据头附件栏位 FALSE
data.claim_lines Array 普通单据行列表 FALSE
data.claim_lines.line_id Long 普通单据行 ID,普通行附件添加时必填 TRUE
data.claim_lines.attachments Object 普通单据行附件栏位 FALSE
data.claim_lines.attachments.file_name String 文件名 FALSE 255
data.claim_lines.attachments.attachment_url String 文件地址 (需提前调用文件上传标准口上传文件,贴上传结果中的文件地址) FALSE
data.claim_lines.attachments.attachment_type_code String 附件类型编码 FALSE
data.claim_lines.attachments1 Object 普通单据行附件栏位 FALSE
data.claim_lines.attachments10 Object 普通单据行附件栏位 FALSE
data.custom_line Array 事项明细行列表 FALSE
data.custom_line.id Long 事项明细行 ID,事项明细行附件添加时必填 TRUE
data.custom_line.attachments1 Object 事项明细行附件栏位 FALSE
data.custom_line.attachments1.file_name String 文件名 FALSE 255
data.custom_line.attachments1.attachment_url String 文件地址 (需提前调用文件上传标准口上传文件,贴上传结果中的文件地址) FALSE
data.custom_line.attachments1.attachment_type_code String 附件类型编码 FALSE
data.custom_line.attachments10 Object 事项明细行附件栏位 FALSE

示例:

请求数据

common/document/addAttachments?externalId=REQ0000025379
{
  "bizId": "4aba2901-8b53-40f5-91fc-e8f375cddc84",
  "timestamp": 1614053054469,
  "data": {
    "attachments": [
      {
        "file_name": "file_name.png",
        "attachment_url": "通过文件上传接口获取到的文件key.png",
        "attachment_type_code": "test002"
      }
    ],
    "attachments1": [
      {
        "file_name": "file_name.png",
        "attachment_url": "通过文件上传接口获取到的文件key.png"
      }
    ],
    "attachments50": [
      {
        "file_name": "file_name.png",
        "attachment_url": "通过文件上传接口获取到的文件key.png"
      }
    ],
    "claim_lines": [
      {
        "line_id": 123456,
        "attachments1": [
          {
            "file_name": "line_file_name.png",
            "attachment_url": "通过文件上传接口获取到的普通行附件文件key.png",
            "attachment_type_code": "test002"
          }
        ]
      }
    ],
    "custom_line": [
      {
        "id": 654321,
        "attachments1": [
          {
            "file_name": "custom_line_file_name.png",
            "attachment_url": "通过文件上传接口获取到的事项明细行附件文件key.png",
            "attachment_type_code": "test002"
          }
        ]
      }
    ]
  }
}

返回示例

正常返回示例

{
  "resCode": 200000,
  "resMsg": "success",
  "bizId": "828c89e0-70a5-4cfd-a82d-8bfccee5bfc0"
}

错误返回示例

{
  "resCode": 400000,
  "resMsg": "单据不存在",
  "bizId": "2c3e5eb1-4d94-45aa-9b89-ccd4296b7bcb"
}

results matching ""

    No results matching ""