Commit 5efb7818 authored by Vadym Gidulian's avatar Vadym Gidulian

Added OpenApi spec

parent 754e7a42
openapi: 3.0.2
info:
title: Mailer service
version: 0.2.0
paths:
/{template}:
post:
summary: Send message with specified template
parameters:
- name: template
in: path
description: Template name
schema:
type: string
required: true
requestBody:
description: Message to be sent
required: true
content:
application/json:
schema:
type: object
required: true
properties:
to:
description: Recipient's address
type: string
format: email
required: true
subject:
description: Message subject
type: string
required: true
vars:
description: Map between variables used in template and their values
type: object
required: false
default: {}
example:
{
"to": "john.doe@example.com",
"subject": "Hello John!",
"vars": {
"name": "John Doe"
}
}
responses:
200:
description: Message has been sent to server
content:
application/json:
schema:
description: Result of sending
type: object
required: true
properties:
messageId:
description: Most servers *should* return the final Message-Id value used
type: string
accepted:
description: Recipients' addresses that were accepted by server
type: array
items:
description: Recipient's address
type: string
rejected:
description: Recipients' addresses that were rejected by server
type: array
items:
description: Recipient's address
type: string
message:
description: Sent message
type: object
properties:
from:
description: Sender's address
type: string
format: email
to:
description: Recipient's address
type: string
format: email
subject:
description: Message subject
type: string
html:
description: Sent message text, specified template compiled with provided variables
type: string
example:
{
"messageId": "<b6cb2a56-03b3-e782-acaf-480865b8d8b5@example.com>",
"accepted": ["john.doe@example.com"],
"rejected": [],
"message": {
"from": "mail@example.com",
"to": "john.doe@example.com",
"subject": "Hello John!",
"html": "Hello John Doe!"
}
}
400:
description: Invalid template name or parameters
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment