1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2025-04-20 02:52:11 +00:00

Add missing endpoints

This commit is contained in:
Richard Willis 2020-08-03 19:49:35 +01:00
parent 85ee3d1c43
commit 9c0df4308b

View File

@ -24,26 +24,23 @@ security:
tags: tags:
- name: User - name: User
description: Endpoints related to user authentication. description: Endpoints related to user authentication.
- name: System - name: Mail
description: | description: |
System operations, which include system status checks, new version checks Mail operations, which include getting all users, getting all aliases, adding/updating/removing users and aliases and getting all mail domains.
and reboot status. - name: DNS
description: |
DNS operations, which include adding custom records, adding a secondary nameserver and viewing all DNS records.
- name: SSL - name: SSL
description: | description: |
TLS (SSL) Certificates operations, which include checking certificate status TLS (SSL) Certificates operations, which include checking certificate status
and installing custom certificates. and installing custom certificates.
- name: DNS
description: |
DNS operations, which include adding custom records, adding a secondary nameserver and viewing all DNS records.
- name: Mail Users
description: |
Mail Users operations, which include getting all users and adding/updating/removing users.
- name: Mail Aliases
description: |
Mail Aliases operations, which include getting all aliases and adding/updating/removing aliases.
- name: Web - name: Web
description: | description: |
Static web hosting operations, which include getting domain information and updating domain root directories. Static web hosting operations, which include getting domain information and updating domain root directories.
- name: System
description: |
System operations, which include system status checks, new version checks
and reboot status.
paths: paths:
/me: /me:
get: get:
@ -106,6 +103,88 @@ paths:
text/html: text/html:
schema: schema:
type: string type: string
/system/version:
get:
tags:
- System
description: Retrieve installed Mail-in-a-Box version.
operationId: getSystemVersion
responses:
200:
description: Successful operation
content:
text/html:
schema:
$ref: '#/components/schemas/SystemVersionResponse'
403:
description: Forbidden
content:
text/html:
schema:
type: string
/system/latest-upstream-version:
post:
tags:
- System
description: Retrieve Mail-in-a-Box upstream version.
operationId: getSystemUpstreamVersion
responses:
200:
description: Successful operation
content:
text/html:
schema:
$ref: '#/components/schemas/SystemVersionUpstreamResponse'
403:
description: Forbidden
content:
text/html:
schema:
type: string
/system/updates:
get:
tags:
- System
description: Retrieve system updates.
operationId: getSystemUpdates
responses:
200:
description: Successful operation
content:
text/html:
schema:
$ref: '#/components/schemas/SystemUpdatesResponse'
403:
description: Forbidden
content:
text/html:
schema:
type: string
/system/update-packages:
post:
tags:
- System
description: Update system packages.
operationId: updateSystemPackages
responses:
200:
description: Successful operation
content:
text/html:
schema:
$ref: '#/components/schemas/SystemUpdatePackagesResponse'
403:
description: Forbidden
content:
text/html:
schema:
type: string
5XX:
description: Server error
content:
text/html:
schema:
type: string
/system/privacy: /system/privacy:
get: get:
tags: tags:
@ -155,6 +234,12 @@ paths:
text/html: text/html:
schema: schema:
$ref: '#/components/schemas/SystemPrivacyUpdateResponse' $ref: '#/components/schemas/SystemPrivacyUpdateResponse'
400:
description: Bad request
content:
text/html:
schema:
type: string
403: 403:
description: Forbidden description: Forbidden
content: content:
@ -186,6 +271,30 @@ paths:
text/html: text/html:
schema: schema:
type: string type: string
post:
tags:
- System
description: Reboot system.
operationId: rebootSystem
responses:
200:
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/SystemRebootResponse'
403:
description: Forbidden
content:
text/html:
schema:
type: string
5XX:
description: Server error
content:
text/html:
schema:
type: string
/system/backup/status: /system/backup/status:
get: get:
tags: tags:
@ -230,8 +339,7 @@ paths:
post: post:
tags: tags:
- System - System
description: | description: Update backup config.
Update backup config.
operationId: updateSystemBackupConfig operationId: updateSystemBackupConfig
requestBody: requestBody:
required: true required: true
@ -275,6 +383,12 @@ paths:
text/html: text/html:
schema: schema:
$ref: '#/components/schemas/SystemBackupConfigUpdateResponse' $ref: '#/components/schemas/SystemBackupConfigUpdateResponse'
400:
description: Bad request
content:
text/html:
schema:
type: string
403: 403:
description: Forbidden description: Forbidden
content: content:
@ -333,6 +447,12 @@ paths:
text/html: text/html:
schema: schema:
$ref: '#/components/schemas/SSLCSRGenerateResponse' $ref: '#/components/schemas/SSLCSRGenerateResponse'
400:
description: Bad request
content:
text/html:
schema:
type: string
403: 403:
description: Forbidden description: Forbidden
content: content:
@ -365,6 +485,38 @@ paths:
text/html: text/html:
schema: schema:
$ref: '#/components/schemas/SSLCertificateInstallResponse' $ref: '#/components/schemas/SSLCertificateInstallResponse'
400:
description: Bad request
content:
text/html:
schema:
type: string
403:
description: Forbidden
content:
text/html:
schema:
type: string
5XX:
description: Server error
content:
text/html:
schema:
type: string
/ssl/provision:
post:
tags:
- SSL
description: |
Provision certificates for all domains.
operationId: provisionSSLCertificates
responses:
200:
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/SSLCertificatesProvisionResponse'
403: 403:
description: Forbidden description: Forbidden
content: content:
@ -452,11 +604,42 @@ paths:
text/html: text/html:
schema: schema:
type: string type: string
/dns/update:
post:
tags:
- DNS
description: Update DNS, which involves creating zone files and restarting `nsd`.
operationId: updateDns
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/DNSUpdateRequest'
responses:
200:
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/DNSUpdateResponse'
400:
description: Bad request
content:
text/html:
schema:
type: string
403:
description: Forbidden
content:
text/html:
schema:
type: string
/dns/custom: /dns/custom:
get: get:
tags: tags:
- DNS - DNS
description: Retrieve custom DNS records. description: Retrieve all custom DNS records.
operationId: getDnsCustomRecords operationId: getDnsCustomRecords
responses: responses:
200: 200:
@ -464,7 +647,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/DNSCustomResponse' $ref: '#/components/schemas/DNSCustomRecordsResponse'
403: 403:
description: Forbidden description: Forbidden
content: content:
@ -485,6 +668,24 @@ paths:
$ref: '#/components/schemas/DNSRecordType' $ref: '#/components/schemas/DNSRecordType'
required: true required: true
description: Record type description: Record type
get:
tags:
- DNS
description: Get DNS records for domain and type
operationId: getDnsCustomRecordsForDomainAndType
responses:
200:
description: Successful operation
content:
text/html:
schema:
$ref: '#/components/schemas/DNSCustomRecordsResponse'
403:
description: Forbidden
content:
text/html:
schema:
type: string
post: post:
tags: tags:
- DNS - DNS
@ -498,7 +699,40 @@ paths:
content: content:
text/html: text/html:
schema: schema:
$ref: '#/components/schemas/DNSCustomRecordAddResponse' $ref: '#/components/schemas/DNSCustomRecordUpsertResponse'
400:
description: Bad request
content:
text/html:
schema:
type: string
example: "'badhostname' does not appear to be an IPv4 or IPv6 address"
403:
description: Forbidden
content:
text/html:
schema:
type: string
5XX:
description: Server error
content:
text/html:
schema:
type: string
put:
tags:
- DNS
description: Update a custom DNS record.
operationId: updateDnsCustomRecord
requestBody:
$ref: '#/components/requestBodies/DNSCustomRecordRequest'
responses:
200:
description: Successful operation
content:
text/html:
schema:
$ref: '#/components/schemas/DNSCustomRecordUpsertResponse'
400: 400:
description: Bad request description: Bad request
content: content:
@ -551,6 +785,131 @@ paths:
text/html: text/html:
schema: schema:
type: string type: string
/dns/custom/{domain}:
parameters:
- in: path
name: domain
schema:
$ref: '#/components/schemas/Hostname'
required: true
description: DNS record domain
get:
tags:
- DNS
description: Get DNS A records for domain
operationId: getDnsCustomRecordsForDomainAndTypeA
responses:
200:
description: Successful operation
content:
text/html:
schema:
$ref: '#/components/schemas/DNSCustomRecordsResponse'
403:
description: Forbidden
content:
text/html:
schema:
type: string
post:
tags:
- DNS
description: Add a custom DNS record.
operationId: addDnsCustomRecordForTypeA
requestBody:
$ref: '#/components/requestBodies/DNSCustomRecordRequest'
responses:
200:
description: Successful operation
content:
text/html:
schema:
$ref: '#/components/schemas/DNSCustomRecordUpsertResponse'
400:
description: Bad request
content:
text/html:
schema:
type: string
example: "'badhostname' does not appear to be an IPv4 or IPv6 address"
403:
description: Forbidden
content:
text/html:
schema:
type: string
5XX:
description: Server error
content:
text/html:
schema:
type: string
put:
tags:
- DNS
description: Update a custom DNS record.
operationId: updateDnsCustomRecordForTypeA
requestBody:
$ref: '#/components/requestBodies/DNSCustomRecordRequest'
responses:
200:
description: Successful operation
content:
text/html:
schema:
$ref: '#/components/schemas/DNSCustomRecordUpsertResponse'
400:
description: Bad request
content:
text/html:
schema:
type: string
example: "'badhostname' does not appear to be an IPv4 or IPv6 address"
403:
description: Forbidden
content:
text/html:
schema:
type: string
5XX:
description: Server error
content:
text/html:
schema:
type: string
delete:
tags:
- DNS
description: Remove a custom DNS record.
operationId: removeDnsCustomRecordForTypeA
requestBody:
$ref: '#/components/requestBodies/DNSCustomRecordRequest'
responses:
200:
description: Successful operation
content:
text/html:
schema:
$ref: '#/components/schemas/DNSCustomRecordRemoveResponse'
400:
description: Bad request
content:
text/html:
schema:
type: string
example: badhostname is not a domain name or a subdomain of a domain name managed by this box
403:
description: Forbidden
content:
text/html:
schema:
type: string
5XX:
description: Server error
content:
text/html:
schema:
type: string
/dns/dump: /dns/dump:
get: get:
tags: tags:
@ -588,7 +947,7 @@ paths:
/mail/users: /mail/users:
get: get:
tags: tags:
- Mail Users - Mail
description: Retrieve all mail users. description: Retrieve all mail users.
operationId: getMailUsers operationId: getMailUsers
parameters: parameters:
@ -616,7 +975,7 @@ paths:
/mail/users/add: /mail/users/add:
post: post:
tags: tags:
- Mail Users - Mail
description: Add a new mail user. description: Add a new mail user.
operationId: addMailUser operationId: addMailUser
requestBody: requestBody:
@ -654,7 +1013,7 @@ paths:
/mail/users/remove: /mail/users/remove:
post: post:
tags: tags:
- Mail Users - Mail
description: Remove a mail user. description: Remove a mail user.
operationId: removeMailUser operationId: removeMailUser
requestBody: requestBody:
@ -692,7 +1051,7 @@ paths:
/mail/users/privileges/add: /mail/users/privileges/add:
post: post:
tags: tags:
- Mail Users - Mail
description: Add a privilege to a mail user. description: Add a privilege to a mail user.
operationId: addMailUserPrivilege operationId: addMailUserPrivilege
requestBody: requestBody:
@ -730,7 +1089,7 @@ paths:
/mail/users/privileges/remove: /mail/users/privileges/remove:
post: post:
tags: tags:
- Mail Users - Mail
description: Remove a privilege from a mail user. description: Remove a privilege from a mail user.
operationId: removeMailUserPrivilege operationId: removeMailUserPrivilege
requestBody: requestBody:
@ -768,7 +1127,7 @@ paths:
/mail/users/password: /mail/users/password:
post: post:
tags: tags:
- Mail Users - Mail
description: Set a password for a user. description: Set a password for a user.
operationId: setMailUserPassword operationId: setMailUserPassword
requestBody: requestBody:
@ -803,10 +1162,54 @@ paths:
text/html: text/html:
schema: schema:
type: string type: string
/mail/users/privileges:
get:
tags:
- Mail
description: Retrieve privileges for a user.
operationId: getMailUserPrivileges
parameters:
- in: query
name: email
schema:
$ref: '#/components/schemas/Email'
description: The email you want to get privileges for.
responses:
200:
description: Successful operation
content:
text/html:
schema:
$ref: '#/components/schemas/MailUserPrivilegesResponse'
403:
description: Forbidden
content:
text/html:
schema:
type: string
/mail/domains:
get:
tags:
- Mail
description: Retrieve all mail domains.
operationId: getMailDomains
responses:
200:
description: Successful operation
content:
text/html:
schema:
$ref: '#/components/schemas/MailDomainsResponse'
403:
description: Forbidden
content:
text/html:
schema:
type: string
/mail/aliases: /mail/aliases:
get: get:
tags: tags:
- Mail Aliases - Mail
description: Retrieve all mail aliases. description: Retrieve all mail aliases.
operationId: getMailAliases operationId: getMailAliases
parameters: parameters:
@ -836,7 +1239,7 @@ paths:
/mail/aliases/add: /mail/aliases/add:
post: post:
tags: tags:
- Mail Aliases - Mail
description: | description: |
Add or update a mail alias. If updating, you need to set `update_if_exists: 1`. Add or update a mail alias. If updating, you need to set `update_if_exists: 1`.
operationId: upsertMailAlias operationId: upsertMailAlias
@ -875,7 +1278,7 @@ paths:
/mail/aliases/remove: /mail/aliases/remove:
post: post:
tags: tags:
- Mail Aliases - Mail
description: Remove a mail alias. description: Remove a mail alias.
operationId: removeMailAlias operationId: removeMailAlias
requestBody: requestBody:
@ -950,6 +1353,12 @@ paths:
text/html: text/html:
schema: schema:
type: string type: string
5XX:
description: Server error
content:
text/html:
schema:
type: string
components: components:
securitySchemes: securitySchemes:
basicAuth: basicAuth:
@ -1015,6 +1424,16 @@ components:
email1@example.com email1@example.com
email2@example.com email2@example.com
description: Get mail users text format response. description: Get mail users text format response.
MailUserPrivilegesResponse:
$ref: '#/components/schemas/MailUserPrivilege'
description: Mail user privileges response.
example: admin
MailDomainsResponse:
type: string
example: |
example1.com
example2.come
description: Mail domains response.
MailUsersResponse: MailUsersResponse:
type: array type: array
items: items:
@ -1024,7 +1443,7 @@ components:
type: object type: object
required: required:
- domain - domain
- Mail Users - users
properties: properties:
domain: domain:
$ref: '#/components/schemas/Hostname' $ref: '#/components/schemas/Hostname'
@ -1215,7 +1634,7 @@ components:
type: string type: string
example: 10 example.com. example: 10 example.com.
description: Custom DNS record detail detail. description: Custom DNS record detail detail.
DNSCustomResponse: DNSCustomRecordsResponse:
type: array type: array
items: items:
$ref: '#/components/schemas/DNSCustomRecord' $ref: '#/components/schemas/DNSCustomRecord'
@ -1240,10 +1659,28 @@ components:
type: string type: string
example: 'updated DNS: example.com' example: 'updated DNS: example.com'
description: Custom DNS record remove response. description: Custom DNS record remove response.
DNSCustomRecordAddResponse: DNSCustomRecordUpsertResponse:
type: string type: string
example: 'updated DNS: example.com' example: 'updated DNS: example.com'
description: Custom DNS record add response. description: Custom DNS record add response.
DNSUpdateRequest:
type: object
required:
- force
properties:
force:
type: integer
format: int32
minimum: 0
maximum: 1
example: 1
description: Force an update even if mailinabox detects no changes are required.
description: DNS update request.
DNSUpdateResponse:
type: string
example: |
updated DNS: example1.com,example2.com
description: DNS update response.
DNSSecondaryNameserverAddRequest: DNSSecondaryNameserverAddRequest:
type: object type: object
required: required:
@ -1422,6 +1859,38 @@ components:
type: string type: string
example: OK example: OK
description: Install certificate response. description: Install certificate response.
SSLCertificatesProvisionResponse:
type: object
required:
- requests
properties:
requests:
type: array
items:
type: object
required:
- log
- result
- domains
properties:
log:
type: array
items:
type: string
example:
- 'The domain name does not resolve to this machine: [Not Set] (A), [Not Set] (AAAA).'
result:
type: string
enum:
- installed
- error
- skipped
example: installed
domains:
type: array
items:
$ref: '#/components/schemas/Hostname'
description: SSL certificates provision response.
SystemPrivacyStatusResponse: SystemPrivacyStatusResponse:
type: boolean type: boolean
description: | description: |
@ -1430,6 +1899,39 @@ components:
- `true`: Private, new-version checks will not be performed - `true`: Private, new-version checks will not be performed
- `false`: Not private, new-version checks will be performed - `false`: Not private, new-version checks will be performed
example: false example: false
SystemVersionResponse:
type: string
description: System version response.
example: v0.46
SystemVersionUpstreamResponse:
type: string
description: System version upstream response.
example: v0.47
SystemUpdatesResponse:
type: string
description: System updates response.
example: |
libgnutls30 (3.5.18-1ubuntu1.4)
libxau6 (1:1.0.8-1ubuntu1)
SystemUpdatePackagesResponse:
type: string
example: |
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
The following packages will be upgraded:
cloud-init grub-common grub-pc grub-pc-bin grub2-common libgnutls30
libldap-2.4-2 libldap-common libxau6 linux-firmware python3-distupgrade
qemu-guest-agent sosreport ubuntu-release-upgrader-core
14 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 79.9 MB of archives.
After this operation, 3893 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libgnutls30 amd64 3.5.18-1ubuntu1.4 [645 kB]
Preconfiguring packages ...
Fetched 79.9 MB in 2s (52.4 MB/s)
(Reading database ... 48457 files and directories currently installed.)
description: System update packages response.
SystemPrivacyUpdateResponse: SystemPrivacyUpdateResponse:
type: string type: string
example: OK example: OK
@ -1442,6 +1944,10 @@ components:
- `true`: A reboot is required - `true`: A reboot is required
- `false`: A reboot is not required - `false`: A reboot is not required
example: true example: true
SystemRebootResponse:
type: string
example: No reboot is required, so it is not allowed.
description: System reboot response.
SystemStatusResponse: SystemStatusResponse:
type: array type: array
items: items: