Added edit and delete endpoints & more
This commit is contained in:
124
api.yaml
124
api.yaml
@@ -154,37 +154,13 @@ paths:
|
|||||||
|
|
||||||
/api/upload:
|
/api/upload:
|
||||||
post:
|
post:
|
||||||
summary: "Uploads a new article"
|
summary: Uploads a new article
|
||||||
requestBody:
|
requestBody:
|
||||||
required: true
|
required: true
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
$ref: '#/components/schemas/Article'
|
||||||
properties:
|
|
||||||
title:
|
|
||||||
type: string
|
|
||||||
description: "Name of the article. Must be unique"
|
|
||||||
summary:
|
|
||||||
type: string
|
|
||||||
description: A short overview summary of the article
|
|
||||||
authors:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: '#/components/schemas/Author'
|
|
||||||
description: List of additional author who contributed to the article. The author which sends this request is automatically added as (main) author
|
|
||||||
image:
|
|
||||||
type: string
|
|
||||||
description: Link to a preview image
|
|
||||||
nullable: true
|
|
||||||
tags:
|
|
||||||
type: array
|
|
||||||
description: Tags the article should have. If the tag does not exist, a new one is created automatically
|
|
||||||
items:
|
|
||||||
$ref: '#/components/schemas/Tag'
|
|
||||||
content:
|
|
||||||
type: string
|
|
||||||
description: The article itself, formatted as markdown
|
|
||||||
security:
|
security:
|
||||||
- cookie: []
|
- cookie: []
|
||||||
responses:
|
responses:
|
||||||
@@ -206,6 +182,66 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/ApiError'
|
$ref: '#/components/schemas/ApiError'
|
||||||
|
|
||||||
|
/api/edit:
|
||||||
|
post:
|
||||||
|
summary: Edit an already existing article
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Article'
|
||||||
|
security:
|
||||||
|
- cookie: []
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: The article was edited
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ArticleSummary'
|
||||||
|
401:
|
||||||
|
description: Not authorized
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ApiError'
|
||||||
|
409:
|
||||||
|
description: A article with the same title already exists
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ApiError'
|
||||||
|
|
||||||
|
/api/delete:
|
||||||
|
post:
|
||||||
|
summary: Deletes an article
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: number
|
||||||
|
description: ID of the article to delete
|
||||||
|
security:
|
||||||
|
- cookie: []
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: The article was edited
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ArticleSummary'
|
||||||
|
401:
|
||||||
|
description: Not authorized
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ApiError'
|
||||||
|
|
||||||
components:
|
components:
|
||||||
schemas:
|
schemas:
|
||||||
@@ -215,6 +251,36 @@ components:
|
|||||||
message:
|
message:
|
||||||
type: string
|
type: string
|
||||||
description: Error message
|
description: Error message
|
||||||
|
Article:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
title:
|
||||||
|
type: string
|
||||||
|
description: "Name of the article. Must be unique"
|
||||||
|
summary:
|
||||||
|
type: string
|
||||||
|
description: A short overview summary of the article
|
||||||
|
authors:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Author'
|
||||||
|
description: List of additional author who contributed to the article. The author which sends this request is automatically added as (main) author
|
||||||
|
image:
|
||||||
|
type: string
|
||||||
|
description: Link to a preview image
|
||||||
|
nullable: true
|
||||||
|
tags:
|
||||||
|
type: array
|
||||||
|
description: Tags the article should have. If the tag does not exist, a new one is created automatically
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Tag'
|
||||||
|
link:
|
||||||
|
type: string
|
||||||
|
description: The link name (last path of the url) which redirects to the article
|
||||||
|
nullable: true
|
||||||
|
content:
|
||||||
|
type: string
|
||||||
|
description: The article itself, formatted as markdown
|
||||||
ArticleSummary:
|
ArticleSummary:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
@@ -237,6 +303,12 @@ components:
|
|||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/Tag'
|
$ref: '#/components/schemas/Tag'
|
||||||
|
created:
|
||||||
|
type: string
|
||||||
|
description: A RFC3339 formatted date when the article was created
|
||||||
|
modified:
|
||||||
|
type: string
|
||||||
|
description: A RFC3339 formatted date when the article was modified
|
||||||
link:
|
link:
|
||||||
type: string
|
type: string
|
||||||
description: Link to the article itself
|
description: Link to the article itself
|
||||||
|
|||||||
Reference in New Issue
Block a user