I am really new to Notion, and I want to use the API for a project.
How I am supposed to insert data in a Notion database ? I know how to read information about the database, I know how to update schema, I know how to retrieve data from database, but I do not know how to insert data to or remove data from database.
THX.
Each data represent a page. So you want to import a page to the database. And here it tells how you can import a page https://developers.notion.com/reference/post-page
exports.newEntryToDatabase = async function (name, description) {
const response = await notion.pages.create({
parent: {
database_id: process.env.NOTION_API_DATABASE,
},
properties: {
Name: {
title: [
{
text: {
content: name,
},
},
],
},
Description: {
rich_text: [
{
text: {
content: description,
},
},
],
},
},
});
return response;
};