获取文章内容
开发中
GET
http://localhost:8098/api/post/content
获取处于
DRAFT(草稿)
、DELETED(已删除)
状态的文章,或者可见性处于 HIDDEN(隐藏)
的文章,会返回 404 错误代码。id(文章 ID)
和 slug(文章别名)
来获取文章内容,postId
优先级更高。请求参数
Query 参数
id
integer
可选
slug
string
可选
password
string
文章密码(如果有)
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request GET 'http://localhost:8098/api/post/content?id&slug&password'
返回响应
🟢200成功
application/json
Body
code
integer
必需
errMsg
null
必需
data
object
必需
post
object
必需
content
string
文章正文内容
示例
{
"code": 200,
"errMsg": null,
"data": {
"post": {
"postId": 5,
"title": "Kotlin 介绍",
"excerpt": "大家好啊,这是一个Kotlin的介绍文章",
"slug": "kotlin introduce",
"cover": "https://loac.cc/logo",
"allowComment": true,
"pinned": true,
"encrypted": true,
"visit": 6,
"category": {
"categoryId": 29,
"displayName": "KotlinA",
"slug": "kotlin",
"cover": "",
"unifiedCover": true,
"postCount": 1
},
"tags": [
{
"tagId": 53,
"displayName": "Kotlin",
"slug": "kotlin",
"color": "#41E8A0",
"postCount": 1
},
{
"tagId": 73,
"displayName": "Kotlin 笔记",
"slug": "kotlin note",
"color": null,
"postCount": 1
}
],
"createTime": 1709547870061,
"lastModifyTime": null
},
"content": "大家好啊,这是一个 Kotlin 的介绍文章"
}
}