NotionCLI - The CLI tool for Notion.co (https://www.notion.so/ja-jp/product).
- To install NotionCLI with pip, run:
pip install notion-cli-py
To use the notion api, you need to create an integration. Please create it here.
After installation, you are required to create config file first. Please run following command.
$ notion-cli configure set
Then you need to put your integration information about the following questions.
Are you sure to create config file in /Users/hiratatomonori/.notion_cli? [y/N]: # Type 'y'.
input config label name: # Type your integration name (e.g. "NotionCLI").
input token for NotionCLI: # Type your integration token.
Do you want to set label (LABEL NAME) to current label? [y/N]: # Type 'y' (if this is your first setting).
Please run following command and check that the configuration is completed properly.
### Check if the target page has the integration that set above.
$ notion-cli get pages ${PAGE_ID}
If page information can be retrieved the minimum setup is complete.
For more detailed information, run notion-cli <command> - --help
or notion-cli <command> <subcommand> - --help
.
### get pages information
$ notion-cli get pages ${PAGE_IDS}
### get pages properties
$ notion-cli get page_properties ${PAGE_IDS} ${PROPERTY_ID}
### get databases information
$ notion-cli get databases ${DATABASE_IDS}
### get blocks information
$ notion-cli get blocks ${BLOCK_IDS}
### get block children information
$ notion-cli get block_children ${BLOCK_IDS}
### get users information
$ notion-cli get users ${USERS_IDS}
### get all users information
$ notion-cli get all_users
### create pages
$ notion-cli create pages ${PALENT_PAGE_IDS} --read-path=${YOUR_FILE_PATH}
### create databases
$ notion-cli create databases ${PALENT_PAGE_IDS} --read-path=${YOUR_FILE_PATH}
### update pages
$ notion-cli update pages ${PALENT_PAGE_IDS} --read-path=${YOUR_FILE_PATH}
### update databases
$ notion-cli update databases ${PALENT_PAGE_IDS} --read-path=${YOUR_FILE_PATH}
### update blocks
$ notion-cli update blocks ${PALENT_PAGE_IDS} --read-path=${YOUR_FILE_PATH}
### delete blocks
$ notion-cli delete blocks ${BLOCK_IDS}
### append block children
$ notion-cli append block_children ${BLOCK_IDS} --read-path=${YOUR_FILE_PATH}
### set your integration information
$ notion-cli configure set
### show your integration information
$ notion-cli configure show
### switch integration
$ notion-cli configure switch ${LABEL_NAME}
### query databases
$ notion-cli query databases ${YOUR_FILE_PATH}
### search objects
$ notion-cli search data ${YOUR_FILE_PATH}
Licensed under the MIT License.
This is NOT an official Notion product.