foliolib.folio.api.email.SmtpConfiguration

class foliolib.folio.api.email.SmtpConfiguration(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)

Bases: foliolib.folio.FolioApi

SMTP server configuration API

API for managing SMTP server configuration

Parameters
  • tenant (str) – Tenant id

  • okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.

Methods

delete_smtpConfiguration(...)

Delete SMTP configuration

get_smtpConfiguration(smtpConfigurationId)

Get SMTP configuration

get_smtpConfigurations(**kwargs)

Retrieve a list of smtpConfiguration items.

modify_smtpConfiguration(...)

Update SMTP configuration

set_smtpConfiguration(smtpConfiguration)

Create a new smtpConfiguration item.

delete_smtpConfiguration(smtpConfigurationId: str, **kwargs)

Delete SMTP configuration

DELETE /smtp-configuration/{smtpConfigurationId}

Parameters
  • smtpConfigurationId (str) –

  • **kwargs (properties) – Keyword Arguments

Keyword Arguments

lang (str) – (default=en) Requested language. Optional. [lang=en]

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

get_smtpConfiguration(smtpConfigurationId: str)

Get SMTP configuration

GET /smtp-configuration/{smtpConfigurationId}

Parameters

smtpConfigurationId (str) –

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Configuration of the SMTP server",
  "title": "SMTP configuration schema",
  "type": "object",
  "properties": {
    "id": {
      "description": "Unique UUID of the configuration",
      "$ref": "raml-util/schemas/uuid.schema"
    },
    "host": {
      "description": "SMTP server host",
      "type": "string"
    },
    "port": {
      "description": "SMTP server port",
      "type": "integer"
    },
    "username": {
      "description": "Username (credentials to access the SMTP server)",
      "type": "string"
    },
    "password": {
      "description": "Password (credentials to access the SMTP server)",
      "type": "string"
    },
    "ssl": {
      "description": "Connect to SMTP server using SSL",
      "type": "boolean"
    },
    "trustAll": {
      "description": "Trust all certificates when establishing an SSL connection",
      "type": "boolean"
    },
    "loginOption": {
      "description": "Login mode",
      "type": "string",
      "enum": [
        "DISABLED",
        "NONE",
        "REQUIRED",
        "XOAUTH2"
      ]
    },
    "startTlsOptions": {
      "description": "Start TLS options",
      "type": "string",
      "enum": [
        "DISABLED",
        "OPTIONAL",
        "REQUIRED"
      ]
    },
    "authMethods": {
      "description": "Authentication methods",
      "type": "string"
    },
    "from": {
      "description": "Email address to send emails from",
      "type": "string"
    },
    "emailHeaders": {
      "description": "Custom email headers",
      "type": "array",
      "id": "emailHeaders",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "description": "Custom header name",
            "type": "string"
          },
          "value": {
            "description": "Custom header value",
            "type": "string"
          }
        },
        "additionalProperties": false,
        "required": [
          "name",
          "value"
        ]
      }
    },
    "metadata": {
      "description": "Metadata about creation and changes to the SMTP configuration provided by the server",
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema"
    }
  },
  "additionalProperties": false,
  "required": [
    "host",
    "port",
    "username",
    "password"
  ]
}
get_smtpConfigurations(**kwargs)

Retrieve a list of smtpConfiguration items.

GET /smtp-configuration

Parameters

**kwargs (properties) – Keyword Arguments

Keyword Arguments
  • offset (int) –

    (default=0) Skip over a number of elements by specifying an offset value for the query

    Example

    • 0

  • limit (int) –

    (default=10) Limit the number of elements returned in the response

    Example

    • 10

  • query (str) –

    A query expressed as a CQL string (see [dev.folio.org/reference/glossary#cql](https://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.

    by using CQL

    Example

    • (username==”ab*” or personal.firstName==”ab*” or personal.lastName==”ab*”) and active==”true” sortby personal.lastName personal.firstName barcode

    • ssl=true

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Collection of SMTP configurations",
  "type": "object",
  "properties": {
    "smtpConfigurations": {
      "description": "List of SMTP configurations",
      "id": "smtpConfigurations",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "smtp-configuration.json"
      }
    },
    "totalRecords": {
      "type": "integer"
    }
  },
  "required": [
    "smtpConfigurations",
    "totalRecords"
  ]
}
modify_smtpConfiguration(smtpConfigurationId: str, smtpConfiguration: dict)

Update SMTP configuration

PUT /smtp-configuration/{smtpConfigurationId}

Parameters
  • smtpConfigurationId (str) –

  • smtpConfiguration (dict) – See Schema below

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiRequestConflict – Conflict

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Configuration of the SMTP server",
  "title": "SMTP configuration schema",
  "type": "object",
  "properties": {
    "id": {
      "description": "Unique UUID of the configuration",
      "$ref": "raml-util/schemas/uuid.schema"
    },
    "host": {
      "description": "SMTP server host",
      "type": "string"
    },
    "port": {
      "description": "SMTP server port",
      "type": "integer"
    },
    "username": {
      "description": "Username (credentials to access the SMTP server)",
      "type": "string"
    },
    "password": {
      "description": "Password (credentials to access the SMTP server)",
      "type": "string"
    },
    "ssl": {
      "description": "Connect to SMTP server using SSL",
      "type": "boolean"
    },
    "trustAll": {
      "description": "Trust all certificates when establishing an SSL connection",
      "type": "boolean"
    },
    "loginOption": {
      "description": "Login mode",
      "type": "string",
      "enum": [
        "DISABLED",
        "NONE",
        "REQUIRED",
        "XOAUTH2"
      ]
    },
    "startTlsOptions": {
      "description": "Start TLS options",
      "type": "string",
      "enum": [
        "DISABLED",
        "OPTIONAL",
        "REQUIRED"
      ]
    },
    "authMethods": {
      "description": "Authentication methods",
      "type": "string"
    },
    "from": {
      "description": "Email address to send emails from",
      "type": "string"
    },
    "emailHeaders": {
      "description": "Custom email headers",
      "type": "array",
      "id": "emailHeaders",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "description": "Custom header name",
            "type": "string"
          },
          "value": {
            "description": "Custom header value",
            "type": "string"
          }
        },
        "additionalProperties": false,
        "required": [
          "name",
          "value"
        ]
      }
    },
    "metadata": {
      "description": "Metadata about creation and changes to the SMTP configuration provided by the server",
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema"
    }
  },
  "additionalProperties": false,
  "required": [
    "host",
    "port",
    "username",
    "password"
  ]
}
set_smtpConfiguration(smtpConfiguration: dict)

Create a new smtpConfiguration item.

POST /smtp-configuration

Parameters

smtpConfiguration (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Headers

  • Location - URI to the created smtpConfiguration item

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Configuration of the SMTP server",
  "title": "SMTP configuration schema",
  "type": "object",
  "properties": {
    "id": {
      "description": "Unique UUID of the configuration",
      "$ref": "raml-util/schemas/uuid.schema"
    },
    "host": {
      "description": "SMTP server host",
      "type": "string"
    },
    "port": {
      "description": "SMTP server port",
      "type": "integer"
    },
    "username": {
      "description": "Username (credentials to access the SMTP server)",
      "type": "string"
    },
    "password": {
      "description": "Password (credentials to access the SMTP server)",
      "type": "string"
    },
    "ssl": {
      "description": "Connect to SMTP server using SSL",
      "type": "boolean"
    },
    "trustAll": {
      "description": "Trust all certificates when establishing an SSL connection",
      "type": "boolean"
    },
    "loginOption": {
      "description": "Login mode",
      "type": "string",
      "enum": [
        "DISABLED",
        "NONE",
        "REQUIRED",
        "XOAUTH2"
      ]
    },
    "startTlsOptions": {
      "description": "Start TLS options",
      "type": "string",
      "enum": [
        "DISABLED",
        "OPTIONAL",
        "REQUIRED"
      ]
    },
    "authMethods": {
      "description": "Authentication methods",
      "type": "string"
    },
    "from": {
      "description": "Email address to send emails from",
      "type": "string"
    },
    "emailHeaders": {
      "description": "Custom email headers",
      "type": "array",
      "id": "emailHeaders",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "description": "Custom header name",
            "type": "string"
          },
          "value": {
            "description": "Custom header value",
            "type": "string"
          }
        },
        "additionalProperties": false,
        "required": [
          "name",
          "value"
        ]
      }
    },
    "metadata": {
      "description": "Metadata about creation and changes to the SMTP configuration provided by the server",
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema"
    }
  },
  "additionalProperties": false,
  "required": [
    "host",
    "port",
    "username",
    "password"
  ]
}