添加文章
开发中POST
http://localhost:8098/admin/post添加文章。
请求参数
Body 参数application/json
title
string
文章标题
<= 256 字符
autoGenerateExcerpt
boolean | null
是否自动生成摘要
默认值:
false
excerpt
string | null
文章摘要
<= 1024 字符
slug
string
文章别名
<= 128 字符
allowComment
boolean
是否允许评论
status
enum<string>
状态
枚举值:
PUBLISHEDDRAFT
visible
enum<string>
可见性
枚举值:
VISIBLEHIDDEN
content
string
文章正文内容(Markdown / PlainText)
categoryId
integer | null
分类 ID
tagIds
array[integer] | null
标签 ID 数组
cover
string | null
封面
<= 512 字符
pinned
boolean | null
是否置顶
默认值:
false
password
string | null
文章密码
<= 64 字符
示例
{
"title": "string",
"autoGenerateExcerpt": "false",
"excerpt": "string",
"slug": "string",
"allowComment": true,
"status": "PUBLISHED",
"visible": "VISIBLE",
"content": "string",
"categoryId": 0,
"tagIds": [
0
],
"cover": "string",
"pinned": "false",
"password": "string"
}
示例代码
返回响应
成功(200)
HTTP 状态码: 200
内容格式: JSONapplication/json
数据结构
code
integer
必需
errMsg
null
必需
data
object
必需
postId
integer
文章 ID
title
string
文章标题
autoGenerateExcerpt
boolean
是否自动生成摘要
excerpt
string
文章摘要
slug
string
文章别名
cover
string | null
文章封面
allowComment
boolean
是否允许评论
pinned
boolean
置顶
status
enum<string>
文章状态
枚举值:
PUBLISHEDDRAFT
visible
enum<string>
文章可见性
枚举值:
VISIBLEHIDDEN
encrypted
boolean
文章是否有密码
password
null
文章密码
始终为 null,密码不会返回
category
object | null
文章分类
tags
array [object {5}]
文章标签
>= 0 items
createTime
integer
创建时间戳
lastModifyTime
integer | null
最后修改时间
示例
添加成功
{
"code": 200,
"errMsg": null,
"data": {
"postId": 4,
"title": "布速角",
"autoGenerateExcerpt": false,
"excerpt": "",
"slug": "elit laboris aliqua",
"cover": "laborum Excepteur culpa",
"allowComment": false,
"pinned": false,
"status": "PUBLISHED",
"visible": "VISIBLE",
"encrypted": false,
"password": null,
"visit": 0,
"category": {
"categoryId": 2,
"displayName": "西各特百族意实",
"slug": "reprehenderit tempor nostrud in",
"cover": "dolor eiusmod",
"unifiedCover": false,
"postCount": 1
},
"tags": [
{
"tagId": 5,
"displayName": "技区具需",
"slug": "eu%20minim",
"color": "#00F9A2",
"postCount": 1
},
{
"tagId": 6,
"displayName": "商日空表红",
"slug": "veniam id Duis commodo",
"color": "#4450Aa",
"postCount": 1
}
],
"createTime": 1709479183524,
"lastModifyTime": null
}
}
最后修改时间: 8 个月前