Skip to content
This repository has been archived by the owner on Apr 25, 2022. It is now read-only.
/ notion-api-server Public archive

It's an API server that can control Notoin's API using HTTP.

License

Notifications You must be signed in to change notification settings

5pecia1/notion-api-server

Repository files navigation

Notion API Server

It's an API server that can control Notoin's API using REST.

TODO

  • add item with property in database
  • add item with content in database
  • add multi page context itme in database
  • update item
  • real RESTful
  • notion key in Authorization in http header

Usage

Quick Start

$ NOTION_TOKEN=xxxx
$ docker run --restart always -e NOTION_TOKEN=${NOTION_TOKEN} -p 5000:5000 --name notion 5pecia1/notion-api-server:latest
$ curl --location --request POST 'http://localhost:5000/database' \
--header 'Content-Type: application/json' \
--data-raw '{
    "database": "https://www.notion.so/3e5fa45b1ced42de9344441cbe033079?v=cf8b57ec9a254072b6f4cfb43b06815c",
    "fields": {
        "status": "Not started",
        "name": "api test"
    },
    "content": "test line1\ntest line2"
}' 
$ curl --location --request POST 'http://localhost:5000/database' \
--header 'Content-Type: application/json' \
--data-raw '{
    "database": "https://www.notion.so/3e5fa45b1ced42de9344441cbe033079?v=cf8b57ec9a254072b6f4cfb43b06815c",
    "query": {
        "Status": "Not started"
    },
    "update": {
        "Status": "In progress"
    } 
}' 

API Reference: .http

JSON Body

  • database: (string) notion database url
  • fields: (JSON)notion database item(page) properties.
    You can add any notion property by JSON key, value
    • name: notion database item(page) title
  • content: (string) notion database item(page) content.

Develop

Prerequisites

  • make
  • Docker
  • Docker Compose
  • python 3.8.x
  • pip 3
  • virtualenv
    • pip install virtualenv

Configure

$ git clone https://github.com/5pecia1/notion-api-server.git
$ cd notion-api-server
$ make init-venv
$ source venv/bin/activate

## exit virtual environment
$ deactivate

Running

$ make run

Docker Build

$ make docker-build

Docker Running

$ make docker-up

CAUTION for developer

  • jamalex/notion-py#132
  • git clone https://github.com/jamalex/notion-py.git && mv notion-py/notion . && rm -rf notion-py
  • current version: b7041ade477c1f59edab1b6fc025326d406dd92a

About

It's an API server that can control Notoin's API using HTTP.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages