【问题标题】:Notion API: how to get the URL of uploaded filesNotion API:如何获取上传文件的 URL
【发布时间】:2021-08-05 15:52:31
【问题描述】:

我正在使用 Notion API Beta,从具有我感兴趣的“文件和媒体”属性的表中读取页面。API 响应只是给了我上传到那里的文件的名称,但我没有没有实际访问它们的 URL。我错过了什么?谢谢。

{
  "Photo": {
    "id": "xxxx",
    "type": "files",
    "files": [
      {
        "name": "000150748673-ofnuhb-t500x500.jpg"
      }
    ]
  }
}

更新:answer


【问题讨论】:

  • 他们是否希望您在工作区 URL 前面添加?我不知道如何以编程方式获取它,但您可能可以硬编码一个字符串以进行测试。
  • @prieber 你从哪里得到这些信息的?它看起来不起作用,它说{ "message": "File not found" }
  • 哦,我只是编造的,我还没有使用过 API,但认为这可能是一个不错的起点。
  • 你现在不能。上传文件的 URL 是在您尝试下载它们时预先指定的。您会注意到它们指向的 URL 中包含 secure.notion-static.com。

标签: notion-api


【解决方案1】:

API 已更新,it now provides a temporary authenticated URL to files uploaded in Notion。例如:

{
  "Photo": {
    "id": "xxxx",
    "type": "files",
    "files": [
      {
        "name": "000150748673-ofnuhb-t500x500.jpg",
        "type": "file",
        "file": {
          "url": "https://s3.us-west-2.amazonaws.com/...",
          "expiry_time": "2021-09-22T09:00:56.029Z"
        }
      }
    ]
  }
}

【讨论】:

    【解决方案2】:

    Notion API 目前不支持文件上传或下载(Notion-Version:2021-05-13)。它不会返回存储文件的 URL。

    【讨论】:

      猜你喜欢
      • 2021-08-08
      • 2021-11-30
      • 2022-07-12
      • 2020-01-05
      • 2013-08-29
      • 2021-08-09
      • 2016-01-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多