【祝公式ベータ公開】Notion の API について調べてみた・Quick Startのエラー
今回は最近私の中で盛り上がっているNotionです🔥🔥🔥
APIについてしらべました!
- 「API使って自動化とか、整理・移行したい!」
- 公式サポートはまだだよ → 5/21に公式ベータが公開されました!
- 有志によるAPIライブラリーはありそう
- Pythonライブラリーを使ってみた
- Notion-pyの作者に共感しました
Notionを使っていて思うのは、、、
「API使って自動化とか、整理・移行したい!」
ということで、NotionのAPIについて調べました!
(2021/05/09現在の情報です)
公式サポートはまだだよ → 5/21に公式ベータが公開されました!
公式ベータは以下からどうぞ developers.notion.com
有志によるAPIライブラリーはありそう
notionのAPIですが、NorthSand)さんによると有志による以下の言語のAPIライブラリーはありそうです
- python: https://github.com/jamalex/notion-py
- Go: https://github.com/kjk/notionapi
- Kotlin: https://github.com/petersamokhin/knotion-api
Pythonライブラリーを使ってみた
pip
でライブラリーをインストールして
pip install notion
Notion-pyのGithubにあるクイックスタート)を実行してみます
いざ実行
んん。エラーがでました。。。
requests.exceptions.HTTPError: Invalid input.
stackoverflowに同じひとがいました。
can't get page title from notion using api
notin-pyの以下2ファイルの limit
の値を 100
に変更するとOKとのこと
- store.py
- client.py
実行してみると、、、
実行前
↓
実行後
確かに変わっています
あーこれで、trello)から移行とかもスクリプトでできてしまいそうですね
Notion-pyの作者に共感しました
When my team introduced me to Notion, it was love at first sight. Notion brings together the best aspects of Trello, spreadsheets, relational databases, rich WYSIWYG Markdown editing, TODO lists, and more, into a single, seamless, flexible, and intuitive system. One problem: there was no documented API. The Notion team has posted about plans for an official API, and Krzysztof Kowalczyk posted a blog and code (in Go) last summer that could pull content from the internal Notion API to generate HTML. But I wanted something that a) gave me full read-write control over my Notion data, and b) was written in my language of choice, Python. from https://medium.com/@jamiealexandre/introducing-notion-py-an-unofficial-python-api-wrapper-for-notion-so-603700f92369
訳文
私のチームがNotionを紹介してくれたとき、一目で気に入りました。Notionは、Trello、スプレッドシート、リレーショナルデータベース、リッチなWYSIWYG Markdown編集、TODOリストなどの最良の側面を、単一の、シームレスで、柔軟で、直感的なシステムにまとめています。問題は、ドキュメント化されたAPIがなかったことです。Notionチームは公式APIの計画について投稿し、Krzysztof Kowalczykは昨年の夏、Notionの内部APIからコンテンツを引き出してHTMLを生成するブログとコード(Go言語)を投稿しました。しかし、私が欲しかったのは、a)Notionのデータを完全に読み書きできるもの、b)私の好きな言語であるPythonで書かれたもの、でした。
Notionは本物のAll in One ワークスペースかもしれません
今後にも期待ですし、公式APIにも期待ですね
(他サービスからの移行がラクになるといいですな🔥)