Email API (v2.0)

http://localhost

Table of contents

mod-email API

The module should provide possibility of sending email through REST API of module.

/email

Entity representing a email

POST /email

Send email notifications

POST /email
Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Body

Media type: application/json

Response 200

success

Body

Media type: text/plain

Type: any

Example:

200 Ok

Response 400

Bad request

Body

Media type: text/plain

Type: any

Example:

Bad request

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error

GET /email

Get emails

GET /email
Query Parameters
  • query: (string)

    A query expressed as a CQL string (see dev.folio.org/reference/glossary#cql) using valid searchable fields. The first example below shows the general form of a full CQL query, but those fields might not be relevant in this context.

    searchable using CQL

    Example:

    (username=="ab*" or personal.firstName=="ab*" or personal.lastName=="ab*") and active=="true" sortby personal.lastName personal.firstName barcode
    
    status==FAILURE
    
  • offset: (integer - default: 0 - minimum: 0 - maximum: 2147483647)

    Skip over a number of elements by specifying an offset value for the query

    Example:

    0
  • limit: (integer - default: 10 - minimum: 0 - maximum: 2147483647)

    Limit the number of elements returned in the response

    Example:

    10
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 200

Returns item with a given ID

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "List of mail entries",
  "properties": {
    "emailEntity": {
      "id": "email",
      "type": "array",
      "description": "Email Entity",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "description": "The mail message that can be sent via email",
        "title": "Email Entity Schema",
        "properties": {
          "notificationId": {
            "description": "notification identifier",
            "type": "string"
          },
          "from": {
            "description": "sender's address",
            "type": "string"
          },
          "to": {
            "description": "address of the recipient",
            "type": "string"
          },
          "header": {
            "description": "subject of email",
            "type": "string"
          },
          "outputFormat": {
            "description": "format type: `text/html` or `text/plain`",
            "type": "string"
          },
          "body": {
            "description": "text of email",
            "type": "string"
          },
          "attachments": {
            "description": "attachment list",
            "id": "attachmentData",
            "type": "array",
            "items": {
              "type": "object",
              "title": "Email attachment",
              "description": "Represent a mail attachment that can be used in a MailMessage",
              "properties": {
                "contentType": {
                  "description": "Content-Type",
                  "type": "string"
                },
                "name": {
                  "description": "name of the attachment",
                  "type": "string"
                },
                "description": {
                  "description": "description field to be used in the attachment",
                  "type": "string"
                },
                "data": {
                  "description": "data",
                  "type": "string"
                },
                "disposition": {
                  "description": "disposition field to be used in the attachment",
                  "type": "string"
                },
                "contentId": {
                  "description": "Content-ID field to be used in the attachment",
                  "type": "string"
                }
              },
              "required": [
                "contentType",
                "name",
                "data"
              ]
            }
          },
          "status": {
            "description": "status of email",
            "type": "string",
            "enum": [
              "DELIVERED",
              "FAILURE",
              "PROCESSING"
            ],
            "default": "DELIVERED"
          },
          "message": {
            "description": "Server error message or other cause of the error",
            "type": "string"
          },
          "date": {
            "description": "The date the email was sent to the SMTP server",
            "type": "string",
            "format": "date-time"
          },
          "metadata": {
            "description": "Metadata about creation and changes to email, provided by the server (client should not provide)",
            "type": "object",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "title": "Metadata Schema",
            "properties": {
              "createdDate": {
                "description": "Date and time when the record was created",
                "type": "string",
                "format": "date-time"
              },
              "createdByUserId": {
                "description": "ID of the user who created the record",
                "type": "string",
                "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
              },
              "createdByUsername": {
                "description": "Username of the user who created the record (when available)",
                "type": "string"
              },
              "updatedDate": {
                "description": "Date and time when the record was last updated",
                "type": "string",
                "format": "date-time"
              },
              "updatedByUserId": {
                "description": "ID of the user who last updated the record",
                "type": "string",
                "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
              },
              "updatedByUsername": {
                "description": "Username of the user who last updated the record (when available)",
                "type": "string"
              }
            },
            "additionalProperties": false,
            "required": [
              "createdDate",
              "createdByUserId"
            ]
          }
        },
        "required": [
          "notificationId",
          "to",
          "header",
          "body"
        ]
      }
    },
    "totalRecords": {
      "description": "total records",
      "type": "integer"
    }
  },
  "required": [
    "emailEntity",
    "totalRecords"
  ],
  "additionalProperties": true
}

Example:

{
  "notificationId":1,
  "to":"user@email.com",
  "from":"admin@email.com",
  "header":"Reset password",
  "body":"Text ........."
}

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to get retrieve email -- unauthorized

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"email not found"

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator