Created
January 11, 2022 00:52
-
-
Save GitMurf/e84a8f9aeeff03c393757afee04efb3e to your computer and use it in GitHub Desktop.
This is a POC test to connecting to the Notion API from Obsidian
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%* | |
const notionApiKey = 'YOUR_API_KEY_SEE_COMMENTS_FOR_HOW_TO_GET'; | |
const reqParams = { | |
url: 'https://api.notion.com/v1/databases', | |
method: 'GET', | |
headers: { | |
"Content-Type": "application/json", | |
Authorization: `Bearer ${notionApiKey}`, | |
"Notion-Version": `2021-08-16`, | |
}, | |
} | |
let requestResults = await window.request(reqParams); | |
let dataResults = JSON.parse(requestResults); | |
let finalResult = dataResults.results[0].title[0].plain_text; | |
tR = `Page Name: ${finalResult}`; | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To get your API Key, follow this guide here: https://developers.notion.com/docs#step-1-create-an-integration
Just need to follow steps 1 and 2 in that guide. I also screen-shotted the instructions from that guide below: