Created
May 9, 2024 07:00
-
-
Save itosho/b365600126b6491c7bb4b8e44259888b to your computer and use it in GitHub Desktop.
Open API Scheme for Notion API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"openapi": "3.1.0", | |
"info": { | |
"title": "Notion API", | |
"version": "v1.0.0" | |
}, | |
"servers": [ | |
{ | |
"url": “xxx”, | |
"description": "アクセスはリバースプロキシを通じて行われます。このプロキシを経由してNotion APIにリクエストがルーティングされます。" | |
} | |
], | |
"paths": { | |
"/v1/blocks/{block_id}/children": { | |
"get": { | |
"description": "指定されたブロックの子要素を取得します。", | |
"operationId": "getBlockChildren", | |
"tags": [ | |
"Blocks" | |
], | |
"parameters": [ | |
{ | |
"name": "block_id", | |
"in": "path", | |
"required": true, | |
"description": "子要素を取得するブロックのID。", | |
"schema": { | |
"type": "string" | |
} | |
}, | |
{ | |
"name": "start_cursor", | |
"in": "query", | |
"description": "子要素のページネーションに使用するカーソル。", | |
"schema": { | |
"type": "string" | |
} | |
}, | |
{ | |
"name": "page_size", | |
"in": "query", | |
"description": "1ページあたりに返される子要素の最大数。", | |
"schema": { | |
"type": "integer" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "ブロックの子要素の取得に成功しました。", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/BlockChildrenResponse" | |
} | |
} | |
} | |
}, | |
"400": { | |
"description": "リクエストが不正です。パラメータが間違っているか、欠けています。", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/ErrorResponse" | |
} | |
} | |
} | |
}, | |
"401": { | |
"description": "認証に失敗しました。APIキーが無効または提供されていません。", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/ErrorResponse" | |
} | |
} | |
} | |
}, | |
"404": { | |
"description": "指定されたブロックIDが見つかりませんでした。", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/ErrorResponse" | |
} | |
} | |
} | |
}, | |
"429": { | |
"description": "リクエストのレートリミットを超えました。", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/ErrorResponse" | |
} | |
} | |
} | |
}, | |
"500": { | |
"description": "サーバー内部エラーが発生しました。", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/ErrorResponse" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/v1/search": { | |
"post": { | |
"description": "全ページおよびデータベースを横断して検索します。", | |
"operationId": "search", | |
"tags": [ | |
"Search" | |
], | |
"requestBody": { | |
"required": true, | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/SearchRequest" | |
} | |
} | |
} | |
}, | |
"responses": { | |
"200": { | |
"description": "検索結果が正常に返されました。", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/SearchResponse" | |
} | |
} | |
} | |
}, | |
"400": { | |
"description": "無効な検索クエリまたはパラメータです。", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/ErrorResponse" | |
} | |
} | |
} | |
}, | |
"401": { | |
"description": "未認証です。APIキーが必要です。", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/ErrorResponse" | |
} | |
} | |
} | |
}, | |
"500": { | |
"description": "検索リクエスト処理中にサーバー内部エラーが発生しました。", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/ErrorResponse" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/v1/databases/xxx/query": { | |
"post": { | |
"description": "データベースをクエリします。", | |
"operationId": "queryDatabase", | |
"tags": [ | |
"Databases" | |
], | |
"parameters": [ | |
{ | |
"name": "database_id", | |
"in": "path", | |
"required": true, | |
"description": "クエリするデータベースのID。", | |
"schema": { | |
"type": "string" | |
} | |
} | |
], | |
"requestBody": { | |
"required": true, | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/DatabaseQueryRequest" | |
} | |
} | |
} | |
}, | |
"responses": { | |
"200": { | |
"description": "データベースクエリが成功しました。", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/DatabaseQueryResponse" | |
} | |
} | |
} | |
}, | |
"400": { | |
"description": "無効なデータベースクエリパラメータまたはリクエストの形式が正しくありません。", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/ErrorResponse" | |
} | |
} | |
} | |
}, | |
"401": { | |
"description": "未認証です。有効なAPIキーが必要です。", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/ErrorResponse" | |
} | |
} | |
} | |
}, | |
"404": { | |
"description": "指定されたデータベースが見つかりませんでした。", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/ErrorResponse" | |
} | |
} | |
} | |
}, | |
"429": { | |
"description": "リクエストが多すぎます。レートリミットを超えています。", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/ErrorResponse" | |
} | |
} | |
} | |
}, | |
"500": { | |
"description": "データベースクエリ中にサーバー内部エラーが発生しました。", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/ErrorResponse" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"components": { | |
"schemas": { | |
"BlockChildrenResponse": { | |
"type": "object", | |
"properties": { | |
"object": { | |
"type": "string", | |
"enum": [ | |
"list" | |
] | |
}, | |
"results": { | |
"type": "array", | |
"items": { | |
"type": "object" | |
} | |
}, | |
"next_cursor": { | |
"type": "string", | |
"nullable": true | |
}, | |
"has_more": { | |
"type": "boolean" | |
} | |
} | |
}, | |
"SearchRequest": { | |
"type": "object", | |
"properties": { | |
"query": { | |
"type": "string", | |
"description": "検索テキスト" | |
}, | |
"sort": { | |
"type": "object", | |
"properties": { | |
"direction": { | |
"type": "string", | |
"enum": [ | |
"ascending", | |
"descending" | |
] | |
}, | |
"timestamp": { | |
"type": "string" | |
} | |
} | |
}, | |
"filter": { | |
"type": "object", | |
"properties": { | |
"property": { | |
"type": "string" | |
}, | |
"value": { | |
"type": "object" | |
} | |
} | |
}, | |
"start_cursor": { | |
"type": "string" | |
}, | |
"page_size": { | |
"type": "integer" | |
} | |
}, | |
"required": [ | |
"query" | |
] | |
}, | |
"SearchResponse": { | |
"type": "object", | |
"properties": { | |
"results": { | |
"type": "array", | |
"items": { | |
"type": "object" | |
} | |
}, | |
"next_cursor": { | |
"type": "string" | |
}, | |
"has_more": { | |
"type": "boolean" | |
} | |
} | |
}, | |
"DatabaseQueryRequest": { | |
"type": "object", | |
"properties": { | |
"filter": { | |
"type": "object" | |
}, | |
"sorts": { | |
"type": "array", | |
"items": { | |
"type": "object" | |
} | |
}, | |
"start_cursor": { | |
"type": "string" | |
}, | |
"page_size": { | |
"type": "integer" | |
} | |
} | |
}, | |
"DatabaseQueryResponse": { | |
"type": "object", | |
"properties": { | |
"object": { | |
"type": "string", | |
"enum": [ | |
"list" | |
] | |
}, | |
"results": { | |
"type": "array", | |
"items": { | |
"type": "object" | |
} | |
}, | |
"next_cursor": { | |
"type": "string" | |
}, | |
"has_more": { | |
"type": "boolean" | |
} | |
} | |
}, | |
"ErrorResponse": { | |
"type": "object", | |
"properties": { | |
"error": { | |
"type": "string", | |
"description": "エラータイプまたはコード" | |
}, | |
"message": { | |
"type": "string", | |
"description": "エラーの詳細な説明" | |
} | |
} | |
} | |
}, | |
"securitySchemes": { | |
"apiKey": { | |
"type": "apiKey", | |
"in": "header", | |
"name": "Authorization" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment