notion-sdk-ts
v1.0.0
Published
Notion API is a REST API that enables programmatic access to Notion workspaces, allowing developers to create, read, update, and manage databases, pages, blocks, users, and comments through authenticated endpoints. It provides comprehensive functionality
Downloads
3
Readme
Getting Started with Notion API
Introduction
Hello and welcome!
To make use of this API collection collection as it's written, please duplicate this database template.
Under the Variables tab, add your environment variables to start making requests. You will need to create an integration to retrieve an API token. You will also need additional values, such as a database ID and page ID, which can be found in your Notion workspace or from the database template mentioned above.
For our full documentation, including sample integrations and guides, visit developers.notion.com.
Please note: Pages that are parented by a database must have the same properties as the parent database. If you are not using the database template provided, the request body for the page endpoints included in this collection should be updated to match the properties in the parent database being used. See documentation for Creating a page for more information.
To learn more about creating an access token, see our official documentation and read our Authorization guide.
Need more help? Join our developer community on Slack.
Install the Package
Run the following command from your project directory to install the package from npm:
npm install [email protected]For additional package details, see the Npm page for the [email protected] npm.
Test the SDK
To validate the functionality of this SDK, you can execute all tests located in the test directory. This SDK utilizes Jest as both the testing framework and test runner.
To run the tests, navigate to the root directory of the SDK and execute the following command:
npm run testOr you can also run tests with coverage report:
npm run test:coverageInitialize the API Client
Note: Documentation for the client can be found here.
The following parameters are configurable for the API Client:
| Parameter | Type | Description |
| --- | --- | --- |
| timeout | number | Timeout for API calls.Default: 0 |
| httpClientOptions | Partial<HttpClientOptions> | Stable configurable http client options. |
| unstableHttpClientOptions | any | Unstable configurable http client options. |
| bearerAuthCredentials | BearerAuthCredentials | The credential object for bearerAuth |
The API client can be initialized as follows:
import { Client } from 'notion-sdk-ts';
const client = new Client({
bearerAuthCredentials: {
accessToken: 'AccessToken'
},
timeout: 0,
});Authorization
This API uses the following authentication schemes.
