Settings (v1.0)

http://localhost

Table of contents

Settings

CRUD APIs used to manage settings for mod-email.

/email/settings

Collection of setting items.

GET /email/settings

Get a list of settings

GET /email/settings
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.

    CQL query

    Example:

    (username=="ab*" or personal.firstName=="ab*" or personal.lastName=="ab*") and active=="true" sortby personal.lastName personal.firstName barcode
    
    key==EMAIL_SMTP_CONFIGURATION
    
  • 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 a list of setting items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Collection of setting records",
  "type": "object",
  "properties": {
    "settings": {
      "description": "The list of settings in this collection",
      "type": "array",
      "id": "settings",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "description": "Setting",
        "properties": {
          "id": {
            "description": "Identifier",
            "$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}$"
          },
          "scope": {
            "type": "string",
            "description": "Scope for this entry (normally a module)",
            "enum": [
              "mod-email"
            ]
          },
          "key": {
            "type": "string",
            "description": "Key within scope for this setting"
          },
          "value": {
            "description": "Settings value (any type)"
          },
          "userId": {
            "type": "string",
            "format": "uuid",
            "description": "Owner of this setting (optional)"
          },
          "_version": {
            "type": "integer",
            "description": "Record version for optimistic locking"
          },
          "metadata": {
            "description": "Metadata about creation and changes to setting, 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"
            ]
          }
        },
        "additionalProperties": false,
        "required": [
          "id",
          "scope",
          "key",
          "value"
        ]
      }
    },
    "totalRecords": {
      "description": "The number of setting records returned in this collection",
      "type": "integer"
    }
  },
  "additionalProperties": false,
  "required": [
    "settings",
    "totalRecords"
  ]
}

Example:

{
  "settings": [
    {
      "id": "65de6432-be11-48ba-9686-a65101634040",
      "key": "smtp-configuration",
      "scope": "mod-email",
      "value": {
        "host": "localhost",
        "port": 502,
        "username": "username",
        "password": "password",
        "ssl": true,
        "trustAll": false,
        "loginOption": "REQUIRED",
        "startTlsOptions": "DISABLED",
        "expirationHours": 24,
        "authMethods": "CRAM-MD5 LOGIN PLAIN",
        "from": "noreply@folio.org",
        "_version": 1,
        "emailHeaders": [
          {
            "name": "Reply-To",
            "value": "noreply@folio.org"
          }
        ]
      }
    }
  ],
  "totalRecords": 1
}

Response 400

Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.

Body

Media type: text/plain

Type: any

Example:

unable to list settings -- malformed parameter 'query', syntax error at column 6

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to list settings -- unauthorized

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

POST /email/settings

Add a new setting

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

    Requested language. Optional. [lang=en]

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Setting",
  "type": "object",
  "properties": {
    "id": {
      "description": "Identifier",
      "$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}$"
    },
    "scope": {
      "type": "string",
      "description": "Scope for this entry (normally a module)",
      "enum": [
        "mod-email"
      ]
    },
    "key": {
      "type": "string",
      "description": "Key within scope for this setting"
    },
    "value": {
      "description": "Settings value (any type)"
    },
    "userId": {
      "type": "string",
      "format": "uuid",
      "description": "Owner of this setting (optional)"
    },
    "_version": {
      "type": "integer",
      "description": "Record version for optimistic locking"
    },
    "metadata": {
      "description": "Metadata about creation and changes to setting, 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"
      ]
    }
  },
  "additionalProperties": false,
  "required": [
    "id",
    "scope",
    "key",
    "value"
  ]
}

Example:

{
  "id": "65de6432-be11-48ba-9686-a65101634040",
  "key": "smtp-configuration",
  "scope": "mod-email",
  "value": {
    "host": "localhost",
    "port": 502,
    "username": "username",
    "password": "password",
    "ssl": true,
    "trustAll": false,
    "loginOption": "REQUIRED",
    "startTlsOptions": "DISABLED",
    "expirationHours": 24,
    "authMethods": "CRAM-MD5 LOGIN PLAIN",
    "from": "noreply@folio.org",
    "emailHeaders": [
      {
        "name": "Reply-To",
        "value": "noreply@folio.org"
      }
    ]
  },
  "_version": 1
}

Response 201

Setting added

Headers
  • Location: required (string)

    URI to the created setting item

Body

Media type: application/json

Type: any

Example:

{
  "id": "65de6432-be11-48ba-9686-a65101634040",
  "key": "smtp-configuration",
  "scope": "mod-email",
  "value": {
    "host": "localhost",
    "port": 502,
    "username": "username",
    "password": "password",
    "ssl": true,
    "trustAll": false,
    "loginOption": "REQUIRED",
    "startTlsOptions": "DISABLED",
    "expirationHours": 24,
    "authMethods": "CRAM-MD5 LOGIN PLAIN",
    "from": "noreply@folio.org",
    "emailHeaders": [
      {
        "name": "Reply-To",
        "value": "noreply@folio.org"
      }
    ]
  },
  "_version": 1,
  "metadata": {
    "createdByUserId": "0c799032-442e-4d01-8e68-8c46529ef978",
    "createdDate": "2023-10-01T12:00:00Z",
    "updatedByUserId": "0c799032-442e-4d01-8e68-8c46529ef978",
    "updatedDate": "2023-10-01T12:00:00Z"
  }
}

Response 400

Bad Request

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "error.schema",
  "description": "An error",
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "description": "Error message text"
    },
    "type": {
      "type": "string",
      "description": "Error message type"
    },
    "code": {
      "type": "string",
      "description": "Error message code"
    },
    "parameters": {
      "description": "Error message parameters",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "parameters.schema",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        }
      }
    }
  },
  "required": [
    "message"
  ]
}

Media type: text/plain

Type: any

Example:

"unable to add setting -- malformed JSON at 13:3"

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create settings -- unauthorized

Response 500

Internal error

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "error.schema",
  "description": "An error",
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "description": "Error message text"
    },
    "type": {
      "type": "string",
      "description": "Error message type"
    },
    "code": {
      "type": "string",
      "description": "Error message code"
    },
    "parameters": {
      "description": "Error message parameters",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "parameters.schema",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        }
      }
    }
  },
  "required": [
    "message"
  ]
}

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

GET /email/settings/{id}

Retrieve setting item with given {settingId}

GET /email/settings/{id}
URI Parameters
  • id: required (string - pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$)

    The UUID of a setting

Query Parameters
  • 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#",
  "description": "Setting",
  "type": "object",
  "properties": {
    "id": {
      "description": "Identifier",
      "$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}$"
    },
    "scope": {
      "type": "string",
      "description": "Scope for this entry (normally a module)",
      "enum": [
        "mod-email"
      ]
    },
    "key": {
      "type": "string",
      "description": "Key within scope for this setting"
    },
    "value": {
      "description": "Settings value (any type)"
    },
    "userId": {
      "type": "string",
      "format": "uuid",
      "description": "Owner of this setting (optional)"
    },
    "_version": {
      "type": "integer",
      "description": "Record version for optimistic locking"
    },
    "metadata": {
      "description": "Metadata about creation and changes to setting, 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"
      ]
    }
  },
  "additionalProperties": false,
  "required": [
    "id",
    "scope",
    "key",
    "value"
  ]
}

Example:

{
  "id": "65de6432-be11-48ba-9686-a65101634040",
  "key": "smtp-configuration",
  "scope": "mod-email",
  "value": {
    "host": "localhost",
    "port": 502,
    "username": "username",
    "password": "password",
    "ssl": true,
    "trustAll": false,
    "loginOption": "REQUIRED",
    "startTlsOptions": "DISABLED",
    "expirationHours": 24,
    "authMethods": "CRAM-MD5 LOGIN PLAIN",
    "from": "noreply@folio.org",
    "emailHeaders": [
      {
        "name": "Reply-To",
        "value": "noreply@folio.org"
      }
    ]
  },
  "_version": 1,
  "metadata": {
    "createdByUserId": "0c799032-442e-4d01-8e68-8c46529ef978",
    "createdDate": "2023-10-01T12:00:00Z",
    "updatedByUserId": "0c799032-442e-4d01-8e68-8c46529ef978",
    "updatedDate": "2023-10-01T12:00:00Z"
  }
}

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"setting 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

DELETE /email/settings/{id}

Delete setting item with given {settingId}

DELETE /email/settings/{id}
URI Parameters
  • id: required (string - pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$)

    The UUID of a setting

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

    Requested language. Optional. [lang=en]

Response 204

Item deleted successfully

Response 400

Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.

Body

Media type: text/plain

Type: any

Example:

"unable to delete setting -- constraint violation"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"setting 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

PUT /email/settings/{id}

Update setting item with given {settingId}

PUT /email/settings/{id}
URI Parameters
  • id: required (string - pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$)

    The UUID of a setting

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

    Requested language. Optional. [lang=en]

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Setting",
  "type": "object",
  "properties": {
    "id": {
      "description": "Identifier",
      "$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}$"
    },
    "scope": {
      "type": "string",
      "description": "Scope for this entry (normally a module)",
      "enum": [
        "mod-email"
      ]
    },
    "key": {
      "type": "string",
      "description": "Key within scope for this setting"
    },
    "value": {
      "description": "Settings value (any type)"
    },
    "userId": {
      "type": "string",
      "format": "uuid",
      "description": "Owner of this setting (optional)"
    },
    "_version": {
      "type": "integer",
      "description": "Record version for optimistic locking"
    },
    "metadata": {
      "description": "Metadata about creation and changes to setting, 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"
      ]
    }
  },
  "additionalProperties": false,
  "required": [
    "id",
    "scope",
    "key",
    "value"
  ]
}

Example:

{
  "id": "65de6432-be11-48ba-9686-a65101634040",
  "key": "smtp-configuration",
  "scope": "mod-email",
  "value": {
    "host": "localhost",
    "port": 502,
    "username": "username",
    "password": "password",
    "ssl": true,
    "trustAll": false,
    "loginOption": "REQUIRED",
    "startTlsOptions": "DISABLED",
    "expirationHours": 24,
    "authMethods": "CRAM-MD5 LOGIN PLAIN",
    "from": "noreply@folio.org",
    "emailHeaders": [
      {
        "name": "Reply-To",
        "value": "noreply@folio.org"
      }
    ]
  },
  "_version": 1,
  "metadata": {
    "createdByUserId": "0c799032-442e-4d01-8e68-8c46529ef978",
    "createdDate": "2023-10-01T12:00:00Z",
    "updatedByUserId": "0c799032-442e-4d01-8e68-8c46529ef978",
    "updatedDate": "2023-10-01T12:00:00Z"
  }
}

Response 204

Item successfully updated

Response 400

Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.

Body

Media type: text/plain

Type: any

Example:

"unable to update setting -- malformed JSON at 13:4"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"setting not found"

Response 409

Optimistic locking version conflict

Body

Media type: text/plain

Type: any

Example:

version conflict

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator