Back to top

Zaqar: Email Microservice

Microservice to send emails to other people.

Email

Send email

Send email
POST/send

Send an email to a recipient

Example URI

POST /send
Request
HideShow
{
  "to": ["to@email.com"],
  "from": "my@email.com",
  "subject": "subject",
  "template": {
    "lang": "mustache",
    "text": "Hello {{name}}"
  },
  "data": {
    "name": "Lucas",
  },
  "cc": ["one@email.com"],
  "bcc": ["two@email.com"]
}
Headers
Content-Type: application/json
Schema
{
  type: 'object',
  properties: {
    from: { oneOf: [{ type: 'string', format: 'email' }, { type: 'object', properties: { name: { type: 'string' }, email: { type: 'string', format: 'email' } } }] },
    to: {
      type: 'array',
      items: {
        anyOf: [{ type: 'string', format: 'email' }, { type: 'object', properties: { name: { type: 'string' }, email: { type: 'string', format: 'email' } } }]
      }
    },
    subject: {
      type: 'string'
    },
    template: {
      type: 'object',
      properties: {
        text: { type: 'string' },
        lang: { type: 'string' }
      },
      additionalProperties: false,
      required: ['text', 'lang']
    },
    cc: {
      type: 'array',
      items: {
        anyOf: [{ type: 'string', format: 'email' }, { type: 'object', properties: { name: { type: 'string' }, email: { type: 'string', format: 'email' } } }]
      }
    },
    data: {
      type: 'object'
    },
    replyTo: {
      oneOf: [{ type: 'string', format: 'email' }, { type: 'object', properties: { name: { type: 'string' }, email: { type: 'string', format: 'email' } } }]
    },
    bcc: {
      type: 'array',
      items: {
        anyOf: [{ type: 'string', format: 'email' }, { type: 'object', properties: { name: { type: 'string' }, email: { type: 'string', format: 'email' } } }]
      }
    }
  },
  required: ['to', 'subject', 'template'],
  additionalProperties: false
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "to": [
    "lucas@test.com"
  ],
  "from": "from@email.com",
  "replyTo": "from@email.com",
  "subject": "test",
  "bcc": [],
  "cc": [],
  "template": {
    "lang": "mustache",
    "text": "Hello {{name}}"
  },
  "data": {
    "name": "Lucas"
  }
}
Response  422
HideShow
Headers
Content-Type: application/json
Body
{
  "status": 422,
  "error": {
    "code": "unprocessable_entity",
    "message": "'template' is required"
  },
  "app": "zaqar"
}
Response  500
HideShow
Headers
Content-Type: application/json
Body
{
  "status": 500,
  "error": {
    "code": "internal_server_error",
    "message": "Unexpected token } in JSON at position 85"
  },
  "app": "zaqar"
}
Response  500
HideShow
Headers
Content-Type: application/json
Body
{
  "status": 500,
  "error": {
    "code": "invalid_renderer",
    "message": "Renderer your_invalid_renderer is invalid"
  },
  "app": "zaqar"
}
Response  500
HideShow
Headers
Content-Type: application/json
Body
{
  "status": 500,
  "error": {
    "code": "failed_to_parse_template",
    "message": "Your renderer message"
  },
  "app": "zaqar"
}

Generated by aglio on 11 Jan 2020