-
Hi! I use the script in the example and success to add one new page with my database. My code shows below. # Initialize the client
notion = Client(auth=NOTION_TOKEN)
# Create a new page
properties = {
"Name": {"title": [{"text": {"content": "test_title"}}]},
"Created": {"date": {"start": "2022-03-28"}},
"Tags": {
"type": "multi_select",
"multi_select": [{"name": "Daily"}]
},
"Property": {
"type": "rich_text",
"rich_text": [
{
"type": "text",
"text": {"content": ""},
},
],
}
}
test_ = notion.pages.create(parent={"database_id": DATABASE_ID}, properties=properties) Thanks for helping. I'm confuse with the official documentation when I use a method with |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
I also asked Notion offical staff and got message replied with this code. curl --location --request POST 'https://api.notion.com/v1/pages' \
--header 'Content-Type: application/json' \
--header 'Notion-Version: 2022-02-22' \
--header 'Authorization: Bearer secret' \
--data-raw '{
"parent": {
"database_id": "YOUR_DATABSE_ID"
},
"properties": {
"title": {
"title": [
{
"type": "text",
"text": {
"content": "A note from your pals at Notion"
}
}
]
}
},
"children": [
{
"object": "block",
"type": "paragraph",
"paragraph": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Paragraph content here"
}
}
]
}
}
]
}' So, I need to find whether there are some way for mapping the payload to this repo. And I have already changed the code to what I want with using curl --location --request POST 'https://api.notion.com/v1/pages' \
--header 'Content-Type: application/json' \
--header 'Notion-Version: 2022-02-22' \
--header 'Authorization: Bearer secret' \
--data-raw '{
"parent": {
"database_id": "YOUR_DATABSE_ID"
},
"properties": {
"title": {
"title": [
{
"type": "text",
"text": {
"content": "test_title"
}
}
]
},
"Tags": {"type": "multi_select", "multi_select": [{"name": "Daily"}]},
"Created": {"date": {"start": "2022-03-28"}}
},
"children": [
{
"object": "block",
"type": "paragraph",
"paragraph": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Yo I am here!"
}
}
]
}
}
]
}' It works perfectly. |
Beta Was this translation helpful? Give feedback.
-
How to create a new page with HTML that contains images |
Beta Was this translation helpful? Give feedback.
I also asked Notion offical staff and got message replied with this code.