Third-Party API
This document explains all publicly available 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 |
You can add an API key by clicking Revornix (avatar in the lower-left corner) -> Account -> APIKey Management.
/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 | File type |
Example Code
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 name |
| description | string | Yes | Section description |
| public | bool | Yes | Whether it is public |
| cover | string | No | Cover image |
| labels | int[] | Yes | Label group |
Example Code
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",
"public": true,
"cover": "test/test.png",
"labels": [1, 2],
}
)/tp/section/label/create
Create a section label
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Label name |
Example Code
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
Retrieve all of my sections
/tp/document/label/list
Retrieve all document labels
/tp/document/label/create
Create a document label
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Label name |
Example Code
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 for file documents, 1 for link documents, 2 for quick note documents |
| from_plat | string | Yes | Source platform; fill in according to your scenario. We recommend using api. |
| sections | int[] | Yes | Sections to publish to |
| auto_summary | boolean | No | Whether to generate a summary automatically |
| labels | int[] | Yes | Label group |
| url | string | Conditional | Link; required for link documents and only valid for link documents |
| content | string | Conditional | Content; required for quick note documents and only valid for quick note documents |
| file_name | string | Conditional | File path (this is the file_path you used when uploading the file); required for file documents and only valid for file documents. You need to upload the file first. |
Example Code
This example demonstrates a link document. Adjust it for other document 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,
"from_plat": "api",
"sections": [],
"auto_summary": True,
"labels": [],
"url": "https://baidu.com"
}
)Last updated on