This content originally appeared on DEV Community and was authored by Christine Kim
Recently, Notion released a beta public API. This is amazing news, as an avid user of Notion, I am excited to find ways to integrate my Notion workplace more seamlessly across tools. The documentation for the API is found here.
This post is just an intro into hitting the API using Postman - instead of using the SDK- just in case if I choose to write an integration in another language.
Setting up the workplace is comprehensive.
- Have a personal workspace
- Go to the Notion integration page. This should already be linked up with your account. Name your project, copy and paste your token somewhere safe!
- Make a page. Share a workspace with your integration, by clicking Share. Your integration you made should be listed.
Now here is a breakdown of the URLs, because I was slightly confused on how to get the ID of certain blocks.
First off, a POST request through Postman.
This is pretty straight forward. First, you need the ID of the database.
Say your workspace has this link (you can get this link by clicking Share, and clicking Copy link in the bottom right of the popup.
The link for this table page is for example is https://www.notion.so/904748e3b5214b28a5e6f74f32048e1f?v=4a8....
I changed the IDs of my pages, so clicking this link will result in a 404.
We want the 904748e3b5214b28a5e6f74f32048e1f part of the url. So copy your database ID down.
I created a page in this page, which contains a table already in my workspace.
With the database ID copied down, I go into Postman and fill a POST request.
In the url field, paste in https://api.notion.com/v1/pages
Remember the secret token we got earlier? Under the Authorization tab, select the TYPE as 'Bearer Token', and paste that token in the text field.
Then in the Body tab, we are going to fill in the data to write an entry into the table.
Make sure to change your database_id with your respective ID (mine was 9047e... ).
Now click Send. If everything was filled out correctly, you should get a JSON response with the id, and the properties of the page!
Congrats, you made your first POST request in Postman with Notion's beta API!
This content originally appeared on DEV Community and was authored by Christine Kim
Christine Kim | Sciencx (2021-05-26T14:50:11+00:00) Using Notion’s new beta API. Retrieved from https://www.scien.cx/2021/05/26/using-notions-new-beta-api/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.