| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v2-article-preview-id.yaml
- put:
- summary: 预览文章正文
- tags:
- - article-preview
- operationId: put_api_v2_article_preview_id_
- description: |-
- PUT /api/v2/article-preview/{id}。用请求体里的 content 覆盖文章正文后走一遍渲染再返回,
- 不写数据库,用于编辑器里的即时预览。
- 权限与查看文章一致:公开文章匿名可预览,否则需要读权限,无权限返回 401。
- 未传 content 时返回 error('no content'),但 HTTP 状态码仍是 200。
- 实现:`ArticleController@preview`
- parameters:
- -
- name: id
- in: path
- required: true
- schema:
- type: string
- description: '文章 uid'
- requestBody:
- required: true
- content:
- application/json:
- schema:
- type: object
- properties:
- content:
- type: string
- description: 待预览的正文内容(markdown)
- anthology:
- type: string
- description: '所在文集 uid,用于渲染文集路径'
- channel:
- type: string
- description: '渲染所用 channel uid,多个用下划线分隔'
- required:
- - content
- responses:
- 200:
- description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
- content:
- application/json:
- schema:
- type: object
- properties:
- ok:
- type: boolean
- message:
- type: string
- data:
- type: object
- properties:
- uid:
- type: string
- title:
- type: string
- subtitle:
- type: string
- summary:
- type: string
- studio:
- type: string
- editor:
- type: string
- status:
- type: integer
- lang:
- type: string
- parent_uid:
- type: string
- created_at:
- type: string
- updated_at:
- type: string
- format:
- type: string
- key:
- type: string
- level:
- type: integer
- mode:
- type: string
- footnote:
- type: string
- origin:
- type: string
- paragraph:
- type: string
- role:
- type: string
- anthology_count:
- type: integer
- anthology_first:
- type: string
- path:
- type: string
- toc:
- type: string
- title_text:
- type: string
- content:
- type: string
- content_type:
- type: string
- html:
- type: string
- _summary:
- type: string
- 401:
- $ref: '../../main.yaml#/components/responses/Unauthorized'
- 422:
- $ref: '../../main.yaml#/components/responses/ValidationError'
|