首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Zapier开发平台获得PDF文件

使用Zapier开发平台获得PDF文件
EN

Stack Overflow用户
提问于 2021-12-08 09:13:48
回答 1查看 118关注 0票数 0

我在Zapier开发平台中创建了一个自定义操作。我的任务是从Xero会计软件加载一个PDF文件到Zapier,以便我可以使用它在我的zap附加到电子邮件。

到目前为止,我有下面的代码,它返回一个成功的响应,但不幸的是,PDF文件始终是空的:

代码语言:javascript
复制
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};

有什么不对的吗?

提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2021-12-17 19:29:54

我在存储pdf时遇到了类似的问题,我注意到如果在调用中使用raw: true,它实际上开始将数据存储在zapier为您保存的pdf文件中。

试一试,让我知道它是否有效!

代码语言:javascript
复制
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};
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70272478

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档