【发布时间】:2021-08-20 09:43:31
【问题描述】:
我在Node JS 和Typecript 有一个项目,我正在与google spreadsheets 合作。
现在我从以下URL 的google API 获取数据:https://developers.google.com/drive/api/v3/reference/files/get 我在fileId 字段中添加电子表格的ID,在supportsAllDrives 字段中添加true 和字段(id、name、modifiedTime )
HTTP 响应如下: 获取https://www.googleapis.com/drive/v3/files/{fileId}
我想要的是在 TypeScript 中使用我在 URL 中添加的属性(fileID 和 supportsAllDrives?
我的问题:如何在 Typescript 代码中使用 fileID 和 supportsAllDrives 属性形成 HTTP 响应?
【问题讨论】:
-
POST 请求不会将参数放入 url,而是将数据对象放入正文。我认为文档中有很多示例。
-
@idfurw 从我输入的 API 的 URL 中,我没有问题。我的问题是,我怎样才能从 Typescript 代码中做到这一点?
-
我不确定我是否理解您想要实现的目标;你能提供更多细节吗?所以基本上你只想在 TypeScript 中发出请求?
-
@ale13 我想形成 API 提供的 URL:GET googleapis.com/drive/v3/files/[fileId}。使用 supportsAllDrives 和 fields 属性,以及我在问题中显示的数据
标签: typescript google-sheets google-api google-sheets-api