forked from plume/documentation
Add canapi and try to use for the API
This commit is contained in:
parent
510e668b3d
commit
0fe09aa742
2 changed files with 60 additions and 0 deletions
15
API.md
Normal file
15
API.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
<script src="//unpkg.com/swagger-ui-dist@3/swagger-ui-bundle.js"></script>
|
||||
|
||||
<div id="api"></div>
|
||||
|
||||
<script>
|
||||
const ui = SwaggerUIBundle({
|
||||
url: "/Plume/api.yaml",
|
||||
dom_id: '#api',
|
||||
presets: [
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIBundle.SwaggerUIStandalonePreset
|
||||
],
|
||||
layout: "StandaloneLayout"
|
||||
})
|
||||
</script>
|
45
api.yaml
Normal file
45
api.yaml
Normal file
|
@ -0,0 +1,45 @@
|
|||
openapi: "3.0"
|
||||
info:
|
||||
version: "1.0.0"
|
||||
title: "Plume REST API"
|
||||
|
||||
servers:
|
||||
- url: http://localhost:7878/api/v1
|
||||
description: Your local instance
|
||||
- url: https://baptiste.gelez.xyz/api/v1
|
||||
description: Demo instance
|
||||
|
||||
paths:
|
||||
/posts/{id}:
|
||||
get:
|
||||
description:
|
||||
Retrieves a post by its ID.
|
||||
responses:
|
||||
'200':
|
||||
The post was found
|
||||
'403':
|
||||
The post exists, but you don't have the rights to fetch it (it is probably a private draft)
|
||||
'404':
|
||||
The post was not found
|
||||
/posts/:
|
||||
get:
|
||||
description:
|
||||
List posts.
|
||||
|
||||
definitions:
|
||||
Post:
|
||||
type: "object"
|
||||
properties:
|
||||
title:
|
||||
type: "string"
|
||||
example: "Hello, world!"
|
||||
id:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
example: 42
|
||||
subtitle:
|
||||
type: "string"
|
||||
example: "My first post."
|
||||
content:
|
||||
type: "string"
|
||||
format: "<p>This is my first post. Thanks for reading.</p>"
|
Loading…
Reference in a new issue