Skip to content

Commit 444d6ca

Browse files
committed
docs: update README for the server
- Refers to the postman documentation - More clarity and expanded on auth
1 parent eeaa286 commit 444d6ca

File tree

1 file changed

+7
-33
lines changed

1 file changed

+7
-33
lines changed

server/README.md

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,16 @@
11
# notion-toolbox's server
22

3-
This is the server component that communicates with Notion's API via [notion-py](https://github.com/jamalex/notion-py). The functionality is to provide CRUD (Create Read Update Delete) operations for blocks and collections.
3+
> https://notion-server.herokuapp.com
44
5-
## Authentication
6-
7-
This server expects a `Notion-Token` to be sent in the request headers. This will be your own `token_v2` from [Notion's cookies](https://www.notion.so/). This will allow you to access your own private content. Tokens are not to be logged or stored anywhere, although if you have concerns you can always host your own server component.
8-
9-
If needed, rate limiting will be used as this server will be running on a free [Heroku](https://heroku.com/) dyno.
10-
11-
## Endpoints
5+
This is the server component that communicates with Notion's API via [notion-py](https://github.com/jamalex/notion-py). The functionality is to provide CRUD (Create Read Update Delete) operations for blocks and collections. The server performs actions using your provided Notion token. This is a public server, and if needed, rate limiting will be used as this server will be running on a free [Heroku](https://heroku.com/) dyno.
126

13-
As of right now the following endpoints exist:
14-
15-
```python
16-
# Allows you to add a piece of text as a child of the specific block (i.e.,
17-
# nesting under a text block, or inside a page)
18-
@app.route('/blocks/<block_id>', methods=['POST'])
19-
20-
# Allows you to update the specified block with new values from the JSON body. Text blocks
21-
# use "title", and collection rows (which are technically blocks) can also
22-
# specify other columns.
23-
@app.route('/blocks/<block_id>', methods=['PUT'])
7+
## Authentication
248

25-
# Allows you to view the content of the specified block. It will take the block's title and
26-
# all of its children's titles and join them with newlines.
27-
@app.route('/blocks/<block_id>', methods=['GET'])
9+
By default, this server expects a `Notion-Token` to be sent in the request headers. This will be your own `token_v2` from [Notion's cookies](https://www.notion.so/). This will allow you to access your own private content. Tokens are not to be logged or stored anywhere, although if you have concerns you can always host your own server component.
2810

29-
# Allows you to delete the specified block. This also works for collection rows
30-
# as they are technically blocks
31-
@app.route('/blocks/<block_id>', methods=['DELETE'])
11+
If needed you can also send a `notion_token` in the JSON body payload, or even as a query parameter. I will mention that using the query parameter approach will expose the token in the Heroku logs.
3212

33-
# Allows you to append a new row onto the specificed collection view with the
34-
# values from the JSON body.
35-
@app.route('/collections/<collection_id>/<view_id>', methods=['POST'])
13+
## Endpoint Documentation
3614

37-
# Allows you to view all the rows of the specified collection view with all the
38-
# column values present.
39-
@app.route('/collections/<collection_id>/<view_id>', methods=['GET'])
40-
```
15+
The endpoints are documented in a [Postman](https://www.postman.com/) collection. You can view the documentation online [here](https://documenter.getpostman.com/view/37310/TVYGdddF). There are free limitations to views, and thus if the monthly limit has been exceeded, you can import the documentation into your own instance of Postman using this [snapshot](https://www.postman.com/collections/9d5e9843e907c1820dcd).
4116

42-
More documentation will follow shortly for these, although you can take a look at the source code for more details.

0 commit comments

Comments
 (0)