|
14 | 14 |
|
15 | 15 | Gatsby source plugin for working with official [Notion](https://notion.so) API. |
16 | 16 |
|
| 17 | +Here's a [Postman](https://www.postman.com/) collection to play around with the API if you're interested: [https://www.postman.com/notionhq/workspace/notion-s-public-api-workspace/overview](https://www.postman.com/notionhq/workspace/notion-s-public-api-workspace/overview) |
| 18 | + |
17 | 19 | ## 🚧 It's a work in progress |
18 | 20 |
|
19 | 21 | This is a source plugin for pulling content into Gatsby from official public Notion API (currently |
@@ -42,10 +44,13 @@ Before using this plugin, make sure you |
42 | 44 | 1. Created a Notion integration (sign in to Notion, go to `Settings & Memberships` → `Integrations` |
43 | 45 | → `Develop your own integrations`, |
44 | 46 | [short link to the Integrations creation section](https://www.notion.so/my-integrations)). It's |
45 | | - OK to use an internal one. Don't forget to copy the token. |
46 | | -2. Go to the database you want to have access to and share it with the integration (`Share` → Select |
| 47 | + OK to use an internal one. Don't forget to copy the token: |
| 48 | +  |
| 49 | +2. Go to the database you want to have access to from Gatsby, and share it with the integration (`Share` → Select |
47 | 50 | the integration in the `Invite` dropdown). Don't forget the database in the URL. It's a series of |
48 | | - characters after the last slash and before the question mark. Here's a reference: |
| 51 | + characters after the last slash and before the question mark. |
| 52 | +  |
| 53 | + Here's a reference: |
49 | 54 | https://www.notion.so/{USER}/**{DATABASE_ID}**?{someotherirrelevantstuff} |
50 | 55 | 3. Then add this to your `gatsby-config.json`: |
51 | 56 |
|
@@ -85,23 +90,83 @@ query { |
85 | 90 | allNotion { |
86 | 91 | edges { |
87 | 92 | node { |
| 93 | +title |
| 94 | +properties |
| 95 | +archived |
| 96 | +createdAt |
| 97 | +updatedAt |
| 98 | +children |
88 | 99 | raw |
89 | 100 | } |
90 | 101 | } |
91 | 102 | } |
92 | 103 | } |
93 | 104 | ``` |
94 | 105 |
|
| 106 | +## Node properties |
| 107 | + |
| 108 | +### `id` |
| 109 | + |
| 110 | +Unique page identifier. This is not a Notion page identifier. You can get the Notion page id under `raw.id`. |
| 111 | + |
| 112 | +### `parent` (Node) |
| 113 | + |
| 114 | +Parend Node. |
| 115 | + |
| 116 | +### `children` |
| 117 | + |
| 118 | +Blocks that belong to the page. |
| 119 | + |
| 120 | +### `title` (String) |
| 121 | + |
| 122 | +Page title joined into one string. |
| 123 | + |
| 124 | +### `properties` |
| 125 | + |
| 126 | +Properties of the page. An object with keys representing database columns (snake-cased), and the following value: |
| 127 | + |
| 128 | +#### `id` (String) |
| 129 | + |
| 130 | +Notion column id |
| 131 | + |
| 132 | +#### `key` (String) |
| 133 | + |
| 134 | +Readable name of the column (without snake case). |
| 135 | + |
| 136 | +#### `value` (\*) |
| 137 | + |
| 138 | +Value of the column for the page. Might have different structure depending on the type. |
| 139 | + |
| 140 | +#### `type` (String) |
| 141 | + |
| 142 | +Notion type of the column. |
| 143 | + |
| 144 | +### `archived` (Boolean) |
| 145 | + |
| 146 | +Boolean. Is **true** if the pages was marked removed but not removed permanently. |
| 147 | + |
| 148 | +### `createdAt` (Date) |
| 149 | + |
| 150 | +Date of page creation. |
| 151 | + |
| 152 | +### `updatedAt` (Date) |
| 153 | + |
| 154 | +Date of the last page update. |
| 155 | + |
| 156 | +### `raw` (\*) |
| 157 | + |
| 158 | +Untouched contents of whatever Notion API returned. |
| 159 | + |
95 | 160 | ## Current state |
96 | 161 |
|
97 | 162 | - Due to the fact that Notion API only appeared recently, and it is still in beta, some blocks are |
98 | 163 | marked "unsupported". Among others, images cannot be fetched for now |
99 | 164 | - Currently, `gatsby-source-notion-api` can only work with one provided database. In further |
100 | 165 | releases, all databases reachable by the Integration will be available for querying |
101 | | -- Nested blocks are currently skipped. E.g. if a list item has a nested sublist, it's contents will |
102 | | - be omitted. This will be fixed in the nearest releases |
103 | | -- Only raw content is available. Raw meaning whatever Notion returns. Further releases will aim at |
104 | | - providing a more convenient data format apart from the raw one |
| 166 | +- ~~Nested blocks are currently skipped. E.g. if a list item has a nested sublist, it's contents will |
| 167 | + be omitted. This will be fixed in the nearest releases~~ Nested blocks are supported as of `0.4.0`! |
| 168 | +- ~~Only raw content is available. Raw meaning whatever Notion returns. Further releases will aim at |
| 169 | + providing a more convenient data format apart from the raw one~~ `0.3.0` features support for **archived**, **createdAt**, **updatedAt**, **properties** and **title**. |
105 | 170 |
|
106 | 171 | ## 🎉 You did it |
107 | 172 |
|
|
0 commit comments