Third-Party API
This document describes all public API endpoints. All requests start with /tp.
All endpoints on this page must include the following request header
| Header | Value |
|---|---|
| API-KEY | your api key |
API keys can be added via Avatar (bottom-left) -> Account -> APIKey Management in Revornix.
/tp/file/upload
Upload a file
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| file | File | Yes | File |
| file_path | string | No | File path |
| content_type | string | No | Content type |
Example
import httpx
client = httpx.Client()
headers = {
"API-KEY": "your api key"
}
files = {
"file": ("example.md", open("example.md", "rb"), "text/markdown")
}
data = {
"file_path": "/files/example.md",
"content_type": "text/markdown"
}
response = client.post(
url="http://localhost:8001/tp/section/create",
headers=headers,
files=files,
data=data
)
/tp/section/create
Create a section
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| title | string | Yes | Section title |
| description | string | Yes | Section description |
| cover | string | No | Cover image |
| labels | int[] | Yes | Label list |
| auto_publish | bool | No | Auto publish |
| auto_podcast | bool | No | Auto-generate audio podcast |
| auto_illustration | bool | No | Auto-generate illustrations |
| process_task_trigger_type | int | Yes | Trigger reason (0: time trigger / 1: update event) |
| process_task_trigger_scheduler | bool | No | Schedule for time trigger (cron expression) |
Example
import httpx
client = httpx.Client()
headers = {
"API-KEY": "your api key"
}
response = client.post(
url="http://localhost:8001/tp/section/create",
headers=headers,
json={
"title": "test title",
"description": "test description",
"cover": "test/test.png",
"labels": [1, 2],
"auto_publish": true,
"process_task_trigger_type": 1
}
)/tp/section/label/create
Create a section label
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Label name |
Example
import httpx
client = httpx.Client()
headers = {
"API-KEY": "your api key"
}
response = client.post(
url="http://localhost:8001/tp/section/label/create",
headers=headers,
json={
"name": "test"
}
)/tp/section/mine/all
Get all my sections
/tp/document/label/list
Get all document labels
/tp/document/label/create
Create a document label
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Label name |
Example
import httpx
client = httpx.Client()
headers = {
"API-KEY": "your api key"
}
response = client.post(
url="http://localhost:8001/tp/document/label/create",
headers=headers,
json={
"name": "test"
}
)/tp/document/create
Create a document
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| category | int | Yes | Document type, 0: file document, 1: link document, 2: quick note document |
| sections | int[] | Yes | Sections to push to |
| labels | int[] | Yes | Label list |
| title | string | No | Title |
| description | string | No | Description |
| cover | string | No | Cover |
| content | string | Yes/No | Content, required for quick notes and only valid for quick note documents |
| url | string | Yes/No | URL, required for link documents and only valid for link documents |
| file_name | string | Yes/No | File path (same as file_path from upload). Required for file documents and only valid for file documents; upload the file first |
| auto_summary | boolean | No | Auto-generate summary |
| auto_podcast | boolean | No | Auto-generate podcast |
| auto_tag | boolean | No | Auto-tag |
| from_plat | string | Yes | Source platform, recommended api |
Example
This example is for link documents only. Modify it for other types.
import httpx
client = httpx.Client()
headers = {
"API-KEY": "your api key"
}
response = client.post(
url="http://localhost:8001/tp/document/create",
headers=headers,
json={
"category": 1,
"url": "https://baidu.com"
"sections": [],
"auto_summary": True,
"labels": [],
"from_plat": "api",
}
)Last updated on