This script is designed to fetch data from a specific Notion database using the Notion API. It requires a Notion object containing an API token for authentication. The script sets up the necessary headers, including authorization and the Notion API version, and makes a POST request to the Notion database's URL. It handles both the successful retrieval of data, returning the parsed JSON, and errors by logging them and rethrowing to be handled by the caller.
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | |
32 | |
33 | |
34 | |
35 | |
36 | |
37 | |
38 | |
39 | |
40 | |