http://localhost
The module should provide possibility of sending email through REST API of module.
Entity representing a email
Send email notifications
POST /email
Requested language. Optional. [lang=en]
Media type: application/json
Get emails
GET /email
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
Skip over a number of elements by specifying an offset value for the query
Example:
0
Limit the number of elements returned in the response
Example:
10
Requested language. Optional. [lang=en]
Returns item with a given ID
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": {
"id": {
"description": "Unique UUID of the email",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "uuid.schema",
"type": "string",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
},
"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"
},
"shouldRetry": {
"description": "Should retry sending email",
"type": "boolean",
"default": false
},
"attemptCount": {
"description": "Number of email sending attempts",
"type": "integer",
"default": 0,
"minimum": 0
},
"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#",
"id": "metadata.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 (when available)",
"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 (when available)",
"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"
]
}
},
"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 ........."
}
Not authorized to perform requested action
Media type: text/plain
Type: any
Example:
unable to get retrieve email -- unauthorized
Item with a given ID not found
Media type: text/plain
Type: any
Example:
"email not found"
Internal server error, e.g. due to misconfiguration
Media type: text/plain
Type: any
Example:
internal server error, contact administrator