获取文章内容
开发中GET
/api/post/content获取文章内容。
获取处于 DRAFT(草稿)
、DELETED(已删除)
状态的文章,或者可见性处于 HIDDEN(隐藏)
的文章,会返回 404 错误代码。
可以通过 id(文章 ID)
和 slug(文章别名)
来获取文章内容,postId
优先级更高。
请求参数
Query 参数
id
integer
可选
文章 ID(ID 和别名至少提供一个)
slug
string
可选
文章别名(ID 和别名至少提供一个)
password
string
文章密码(如果有)
示例代码
返回响应
成功(200)
HTTP 状态码: 200
内容格式: JSONapplication/json
数据结构
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 的介绍文章"
}
}
最后修改时间: 9 个月前