Notion-java-sdk is a java version of Notion API.
It provides:
- Basic packaging of Notion objects (
com._2lazy2name.notion.entity
) - Basic API request (
com._2lazy2name.notion.Notion
)
Basic entities and API requests are checked, but not guaranteed safe to use.
The API is based on the API Version of 2022-06-28, which is the latest version on Feb 19, 2023. Future updates are NOT guaranteed, which also means Notion Version in headers is not configurable before a new release.
The project is written on the source level of Java 17. Since enhanced switch blocks are used somewhere, the minimum version accepted is Java 14. All you need to change to make it compatible with Java 8 is two switch blocks in FilterSerializer
.
- Add dependency in
pom.xml
<dependency>
<groupId>com.2lazy2name</groupId>
<artifactId>notion-java-sdk</artifactId>
<version>v0.1.0-SNAPSHOT</version>
</dependency>
-
Instantiated
Notion.class
-
If you are using Spring-Framework:
@Bean Notion notion() { Notion notion = new Notion(NOTION_TOKEN); return notion; }
-
If you are using vanilla Java, Simply use the constructor:
Notion notion = new Notion(NOTION_TOKEN);
-
-
All the official endpoints are provided in
Notion.class
as methods. There are properly annotated and linked to official notion documents. -
If you believe there is an error with this project:
- For
IOException
: usenotion.setDebugEnabled(true)
, and attach Http request details in the issue. - For
JsonParsingException
: provide the fields value of the object type that you are dealing with in the issue.
- For
Jackson and Apache Http Client5.
- Make it compatible to Java 8.
- Add more tests. (Well, maybe when I encounter some bugs.)
- Update to the latest version of Notion API.
I don’t check GitHub very often. For any issues or commit, there are some ways to quicker notices and solutions:
- E-mail [email protected]
- Notion Page - Check the test cases for usage.
- Telegram Group
Suggestions in code styles and implementation with optimization advice are highly welcomed.
This Repository is NOT provided by Notion and NOT endorsed by Notion. There are also some potential bugs and performance issues. THINK whether you are OK for the risk before you really use it.