我在Zapier开发平台中创建了一个自定义操作。我的任务是从Xero会计软件加载一个PDF文件到Zapier,以便我可以使用它在我的zap附加到电子邮件。
到目前为止,我有下面的代码,它返回一个成功的响应,但不幸的是,PDF文件始终是空的:
const pdfURL = {
url: 'https://api.xero.com/api.xro/2.0/Quotes/' + bundle.inputData.QuoteID,
method: 'GET',
headers: {
'Accept': 'application/pdf',
'Authorization': `Bearer ${bundle.authData.access_token}`,
'Xero-tenant-id': bundle.inputData.TenantID
}
};
const fileRequest = await z.request(pdfURL);
const url = await z.stashFile(fileRequest); // knownLength and filename will be sniffed from the request. contentType will be binary/octet-stream
return {url};
有什么不对的吗?
提前谢谢。
发布于 2021-12-17 19:29:54
我在存储pdf时遇到了类似的问题,我注意到如果在调用中使用raw: true,它实际上开始将数据存储在zapier为您保存的pdf文件中。
试一试,让我知道它是否有效!
const pdfURL = {
url: 'https://api.xero.com/api.xro/2.0/Quotes/' + bundle.inputData.QuoteID,
method: 'GET',
headers: {
'Accept': 'application/pdf',
'Authorization': `Bearer ${bundle.authData.access_token}`,
'Xero-tenant-id': bundle.inputData.TenantID
},
raw: true
};
const fileRequest = await z.request(pdfURL);
const url = await z.stashFile(fileRequest); // knownLength and filename will be sniffed from the request. contentType will be binary/octet-stream
return {url};https://stackoverflow.com/questions/70272478
复制相似问题