makenotion / notion-sdk-js

Official Notion JavaScript Client
https://developers.notion.com/docs
MIT License
4.95k stars 591 forks source link

unable to add external to files #491

Closed mediamods closed 9 months ago

mediamods commented 9 months ago

Describe the bug

I have a table with a column for Files & media.

Using the js api, I try to add to it like this:

await nClient.pages.update({ page_id: pageId, properties: { "uploady": { "files": [ { "external": { "url": "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" } } ] } }

I believe this should work. Instead, I get this error: update error APIResponseError: body failed validation. Fix one: body.properties.uploady.files[0].file should be defined, instead wasundefined. body.properties.uploady.files[0].name should be defined, instead wasundefined.

To Reproduce Node version: 2.16.2 Notion JS library version: 2.2.13

mediamods commented 9 months ago
      await nClient.pages.update({
        page_id: pageId,
        properties: {
          "uploady": {
            "files":
              [
                {
                  "type": "external",
                  "name": "Space Wallpaper",
                  "external": {
                    "url": "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"
                  }
                }
              ]
          }
        }
      });