sero/openapi.yml

438 lines
11 KiB
YAML

openapi: 3.1.0
info:
title: sero API
description: API of sero server
version: 1.0.0
paths:
/api/health:
get:
summary: Check that server is alive
responses:
"200":
description: Server is alive
/api/login:
post:
summary: Authenticate user
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
$ref: "#/components/schemas/AuthCredentials"
responses:
"200":
description: Authentication successful, returns AuthToken
content:
application/json:
schema:
$ref: "#/components/schemas/AuthToken"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"401":
description: Authentication failed, unauthorized
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"500":
description: Server error
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
/api/registration:
post:
summary: Register user
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
$ref: "#/components/schemas/AuthCredentials"
responses:
"200":
description: Registration succeeded
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"409":
description: Registration failed, user has already been registered
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"500":
description: Server error
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
/api/enable:
post:
summary: Enable site
parameters:
- in: header
name: X-Subdomain
schema:
type: string
required: true
security:
- bearerAuth: []
responses:
"200":
description: Site was successfully enabled
"403":
description: Subdomain is owned by another user
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"401":
description: Unauthorized
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"404":
description: Subdomain was not found
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"500":
description: Server error
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
/api/disable:
post:
summary: Enable site
parameters:
- in: header
name: X-Subdomain
schema:
type: string
required: true
security:
- bearerAuth: []
responses:
"200":
description: Site was successfully disabled
"403":
description: Subdomain is owned by another user
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"404":
description: Subdomain was not found
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"401":
description: Unauthorized
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"500":
description: Server error
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
/api/teardown:
post:
summary: Enable site
parameters:
- in: header
name: X-Subdomain
schema:
type: string
required: true
security:
- bearerAuth: []
responses:
"200":
description: Site was deleted
"403":
description: Subdomain is owned by another user
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"404":
description: Subdomain was not found
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"401":
description: Unauthorized
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"500":
description: Server error
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
/api/download:
post:
summary: Download site as zip
parameters:
- in: header
name: X-Subdomain
schema:
type: string
required: true
security:
- bearerAuth: []
responses:
"200":
description: Site was successfully downloaded
content:
application/octet-stream:
schema:
type: string
format: binary
"403":
description: Subdomain is owned by another user
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"404":
description: Subdomain was not found
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"401":
description: Unauthorized
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"500":
description: Server error
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
/api/upload:
post:
summary: Upload site as zip
parameters:
- in: header
name: X-Subdomain
schema:
type: string
required: true
security:
- bearerAuth: []
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
archive:
type: string
format: binary
responses:
"200":
description: Site was successfully uploaded
"403":
description: Subdomain is owned by another user
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"401":
description: Unauthorized
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"500":
description: Server error
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
/api/cors/add:
post:
summary: Add origin
parameters:
- in: header
name: X-Subdomain
schema:
type: string
required: true
security:
- bearerAuth: []
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
$ref: "#/components/schemas/Origin"
responses:
"200":
description: Origin was successfully added
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"401":
description: Authentication failed, unauthorized
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"403":
description: Subdomain is owned by another user
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"500":
description: Server error
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
/api/cors/clear:
post:
summary: Clear related origins
parameters:
- in: header
name: X-Subdomain
schema:
type: string
required: true
security:
- bearerAuth: []
responses:
"200":
description: Origins were successfully removed
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"401":
description: Authentication failed, unauthorized
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"403":
description: Subdomain is owned by another user
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
"500":
description: Server error
content:
application/json:
schema:
$ref: "#/components/schemas/Details"
components:
schemas:
AuthCredentials:
type: object
properties:
username:
type: string
password:
type: string
AuthToken:
type: object
properties:
token:
type: string
Details:
type: object
properties:
details:
type: string
Origin:
type: object
properties:
origin:
type: string
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT