有没有办法为 xero 上的发票付款添加附件?
Is there a way to add an attachment to a payment for an invoice on xero?
在 Xero UI 上,有一种方法可以转到为发票付款并添加附件。
如何通过 API 做到这一点?
如果我尝试使用附件 API 向付款添加附件 -
https://api.xero.com/api.xro/2.0/Payments/{PaymentID}/附件/{文件名} ,
我得到 HTTPNotFound。
但是,付款 ID 确实存在,我可以在 Xero UI 上看到它,并且还可以通过付款 API 获取付款详细信息 -
https://api.xero.com/api.xro/2.0/Payments/{付款 ID}
编辑:
我正在使用 Ruby Net::HTTP 进行 API 调用。
它在将附件发布到发票时有效 -
https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/附件/{文件名}
我知道他们的文档 - https://developer.xero.com/documentation/api/attachments - 没有提到附件的支付端点。但是,UI 允许它。所以,我想知道是否有某种方法可以通过 API.
很遗憾,您无法通过 API 上传附件到付款。
您可以使用 Xero 的文件 API 上传文件并创建与付款的关联。
您需要先将文件上传到 https://api.xero.com/files.xro/1.0/Files
- File Upload
...然后通过将类似的内容发布到 https://api.xero.com/files.xro/1.0/Files/{fileId}/Associations
- File Associations:
来创建关联
{
"ObjectId":"{paymentid}",
"ObjectGroup":"Payment"
}
在 Xero UI 上,有一种方法可以转到为发票付款并添加附件。 如何通过 API 做到这一点? 如果我尝试使用附件 API 向付款添加附件 - https://api.xero.com/api.xro/2.0/Payments/{PaymentID}/附件/{文件名} , 我得到 HTTPNotFound。
但是,付款 ID 确实存在,我可以在 Xero UI 上看到它,并且还可以通过付款 API 获取付款详细信息 - https://api.xero.com/api.xro/2.0/Payments/{付款 ID}
编辑: 我正在使用 Ruby Net::HTTP 进行 API 调用。 它在将附件发布到发票时有效 - https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/附件/{文件名}
我知道他们的文档 - https://developer.xero.com/documentation/api/attachments - 没有提到附件的支付端点。但是,UI 允许它。所以,我想知道是否有某种方法可以通过 API.
很遗憾,您无法通过 API 上传附件到付款。
您可以使用 Xero 的文件 API 上传文件并创建与付款的关联。
您需要先将文件上传到 https://api.xero.com/files.xro/1.0/Files
- File Upload
...然后通过将类似的内容发布到 https://api.xero.com/files.xro/1.0/Files/{fileId}/Associations
- File Associations:
{
"ObjectId":"{paymentid}",
"ObjectGroup":"Payment"
}