获取文章 - ID
开发中GET
/api/post/{postId}根据文章 ID 获取文章。
请求参数
Path 参数
postId
integer
文章 ID
示例代码
返回响应
成功(200)
HTTP 状态码: 200
内容格式: JSONapplication/json
数据结构
code
integer
必需
errMsg
null
必需
data
object
必需
postId
integer
文章 ID
title
string
文章标题
excerpt
string
文章摘要
slug
string
文章别名
cover
string | null
文章封面
allowComment
boolean
是否允许评论
pinned
boolean
是否置顶
encrypted
boolean
文章是否有密码
visit
number
访问量
category
object | null
文章分类
tags
array [object {5}]
文章标签
createTime
integer
文章创建时间戳
lastModifyTime
integer | null
文章最后修改时间戳
示例
成功示例
{
"code": 200,
"errMsg": null,
"data": {
"postId": 2,
"title": "测试文章",
"excerpt": "这是一篇测试文章",
"slug": "ceshiwenzhang",
"cover": "/upload/wallhaven-rrekmm.jpg",
"allowComment": true,
"pinned": false,
"encrypted": false,
"visit": 0,
"category": {
"categoryId": 1,
"displayName": "Test",
"slug": "test",
"cover": "/upload/wallhaven-5gpv25_qci8z.jpg",
"unifiedCover": true,
"postCount": 1
},
"tags": [
{
"tagId": 3,
"displayName": "Kotlin",
"slug": "kotlin",
"color": null,
"postCount": 1
},
{
"tagId": 2,
"displayName": "学习笔记",
"slug": "xuexibiji",
"color": null,
"postCount": 1
},
{
"tagId": 1,
"displayName": "书籍",
"slug": "test",
"color": "",
"postCount": 1
}
],
"createTime": 1713618786491,
"lastModifyTime": 1713619288120
}
}
最后修改时间: 9 个月前