This is a simple API client for Notion.so. It is based on the official Notion API documentation.
First, you need to create a Notion integration.
- Go to the Notion integrations page.
- Click on the
+ New integrationbutton. - Fill in the required fields and click on the
Submitbutton. - Copy the
Internal Integration Tokenand save it in a safe place. - Share the integration with your workspace and add it to the Sites or Databases you want the Api to have access to.
After you have created your integration, you can import the NotionApiClient via Maven or Gradle.
<dependency>
<groupId>de.flix29</groupId>
<artifactId>notion-api-client</artifactId>
<version>1.1.0</version>
</dependency>implementation 'de.flix29:notion-api-client:1.1.0'You need to create a NotionClient object and pass the Internal Integration Token to the constructor.
import de.flix29.notionApiClient.NotionClient;
NotionClient notionClient = new NotionClient("your-token");Then, you can use the methods provided in the NotionClient class to interact with the Notion API.
Currently, mainly the Get endpoints are supported. These are the following:
GETRetrieve a BlockGETRetrieve a Block childrenDELETEDelete a Block