You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Postman向Xero提交Put请求创建发票遇Error 10求助

解决Xero PUT创建发票时Error Number 10的问题

问题原因

你提交的请求体结构错误,把请求头参数(xero-tenant-id、Accept、Content-Type)和发票数据都嵌套在了parameters -> body层级中,导致Xero API无法正确识别Type字段,因此抛出"Invoice Type must be specified"的验证错误。

修正方案

  1. 拆分请求头与请求体
    在Postman的Headers标签页单独配置以下头部信息,不要把它们放在请求体里:

    • xero-tenant-id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    • Accept: application/json
    • Content-Type: application/json
  2. 简化请求体结构
    移除外层的parameters和body嵌套,直接提交发票的核心数据:

    {
        "Type": "ACCREC",
        "Reference": "Pick Up",
        "Contact": {
            "ContactID": "5fc528e0-3a47-4c02-bede-f73fd6ec2709"
        },
        "LineItems": [
            {
                "Quantity": 504,
                "ItemCode": "1422.7"
            }
        ]
    }
    
  3. 确认请求方法的正确性
    创建新发票应该使用POST请求,对应的API端点是https://api.xero.com/api.xro/2.0/Invoices。如果你的场景是更新现有发票,才需要用PUT请求,且URL必须包含目标发票的ID(格式为https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID})。

内容的提问来源于stack exchange,提问作者365 Assist

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 04:57:32