get_domain

The get_domain method retrieves the settings and information for a specified domain.

Syntax

Request

{
    <credentials object>, 
    "domain": <domain name>
}

Response

If the domain exists and the user can access it

{
    "success": true,
    "settable_attribute": [list of attribute names], 
    "metadata":
        {
        "options": {key value pairs} 
        "bulletins":
        {
            "manual": [{bulletin info}, {bulletin info}, ...],
            "auto": [{bulletin info}, {bulletin info}, ...] 
        },
        "createtime": <domain creation time> 
        },
        "inherit":
            "default_password_encoding": <encoding type>, 
            "brand": <brand>,
            "filterdelivery": <quarantine | passthrough>, 
            "password_strength": <string>,
            "regen_passwords": <boolean>,
            "smtp_sent_limit": <number>,
            "spamfolder": <folder>, 
            "spamheader":<header>,
            "spamtag": <tag>,
            "spamlevel": <level>
        }
    },
    "attributes": {key value pairs} 
}

If the domain does not exist but the user could create it

{
    "success": false,
    "error_number": 2,
    "error": "The requested object does not exist", 
    "settable_attribute" [list of attribute names], 
    "metadata":
    {
        "options": {key value pairs}
        "defaults": {key value pairs} 
    },
}

Request fields for get_domain

The following fields can be used in the get_domain method:

Field name

Obligation

Definition/Value

domain

Required

The domain whose settings you want to view.

Response fields for get_domain

The following fields may be returned in response to the get_domain method:

Field name

Obligation

Description/Value

attributes

Returned if domain exists

A list of the attributes and values associated with the domain.

For more information, see the Attributes table below.

error

Returned if success = false

A text string that explains the error.

error_number

Returned if success = false

A number that represents the error.

metadata

Returned if domain exists or can be created

Allowed values are: bulletins, createtime, defaults, inherit, and options.

For more information, see the Metadata table below.

settable_attribute

Returned if domain exists or can be created

The attributes that can be set and the services that can be enabled, disabled, or suspended.

Allowed values are:

aliases, allow, block, brand, default_password_encoding, disabled, filterdelivery, filtermx, language, limit_aliases, limit_users, notes_external, quota, quota_maximum, regen_passwords, service_imap4, service_pop3, service_smtpin, service_smtprelay, service_smtprelay_webmail, service_webmail, spamfolder, spam_header, spamlevel, spamtag, stats_mailout, timezone, wm_domainalias, and workgroup

success

Always returned

Indicates whether the request was successful or not. Allowed values are true and false.

Attributes fields

The following fields may be returned within the attributes array.

Field name

Obligation

Definition/Value

account

Always returned

The domain name.

aliases

Optional

A list of alternate names for the domain. Users in the domain can receive mail that is sent to an alias domain. For example, if example- corporation.com is an alias for example.com, so mail that is sent to [email protected] corporation.com will be delivered to [email protected] The maximum number of aliases is 2000.

allow

Optional

A list of senders whose messages are not scanned for spam; may include wildcards. For example [email protected] and *@example.com. Maximum is 1000 addresses.

block

Optional

A list of email addresses whose messages will always be identified as spam; may include wildcards. For example, [email protected] and *@spammers-inc.com. Messages from these addresses will always be considered to be spam. Maximum is 1000 addresses.

brand

Optional

The default brand used for mailboxes in the domain. If undefined, the company brand is used.

catchall

Optional

If set, any mail sent to a mailbox in the domain that does not exist will be sent to the specified mailbox.

Note: This feature cannot be enabled for new domains.

company

Always returned

The company to which the domain belongs.

default_password _encoding

Optional

The type of password hashing/encoding to be performed when OpenSRS receives an unencrypted password to store for a user.

disabled

Optional

If set to true, mailboxes in the domain will not function.

filterdelivery

Optional

The way in which spam messages are handled by the OpenSRS email filter. Allowed values are:

  • quarantine — Spam messages are stored locally in the user's spam folder.

  • passthrough — Spam messages are delivered with the specified spamtag and spamheader.

If undefined, the company's value is used.

filtermx

Optional

The mail server (and optionally SMTP port) to which messages received by filter users in this domain are sent after spam and virus scanning.

language

Optional

The default Webmail UI language for new users in the domain. May be overridden by the user.

limit_aliases

Optional

The maximum number of aliases that can be created for mailboxes in the domain. If this number is less than the number of aliases currently in the domain, no new aliases can be created. If not defined, any number of aliases can be created.

limit_users

Optional

The maximum number of users that can be created in the domain. If this number is less than the number of users currently in the domain, no new users can be created. If undefined, any number of users can be created.

notes_external

Always returned

Any notes that were added through the change_domain method. Maximum is 4096 characters. If there are no notes, returns null.

password

Optional

Indicates whether a password is set.

If a password exists, it is displayed as ****

If there is no password, the returned value is null.

quota

Optional

The default maximum amount of storage (in bytes) that new mailboxes may use, including mail and file storage.

quota_maximum

Optional

The default maximum quota (in Megabytes) that can be assigned to any mailbox in the domain.

password_strength

Optional

The minimum level at which the password strength checks must pass (see change_user).

If set to null, the value will be inherited from the company level.

regen_passwords

Optional

If set to true, the next time a user logs in, their passwords will be converted to the encoding specified in default_password_encoding (if their current encoding differs from the one specified in default_password_encoding).

service_imap4

Optional

The default setting for new users in the domain (enabled, disabled, or suspended). If enabled, new users can log in via IMAP4.

service_pop3

Optional

The default setting for new users in the domain (enabled, disabled, or suspended). If enabled, new users can log in via POP3.

service_smtpin

Optional

The default setting for new users in the domain (enabled, disabled, or suspended). If enabled, new users can send email.

service_smtprelay

Optional

The default setting for new users in the domain (enabled, disabled, or suspended).

service_smtprelay_webmail

Optional

The default setting for new users in the domain (enabled, disabled, or suspended). If enabled, new users send email via Webmail.

service_webmail

Optional

The default setting for new users in the domain (enabled, disabled, or suspended). If enabled, new users can log in via Webmail.

smtp_sent_limit

Optional

The default maximum number of messages that the user can send in a 24 hour period. Maximum number is 10,000. If not defined, the company's smtp_sent_limit is used.

spamfolder

Optional

The folder to which messages that have been identified as spam are delivered.

spamheader

Optional

The tag that will be assigned to the header of spam messages. The format for the header must be [Capital letter]anything[:] anything. For example, XSpam: Spam detected.

spamlevel

Optional

The level of aggressiveness for spam filtering. Allowed values are: Normal, High, and Very High.

spamtag

Optional

The tag that is appended to an email message to identify it as spam.

stats_mailout

Optional

The addresses to which snapshots of domain usage are sent. Maximum is 100 addresses.

timezone

Optional

The default Webmail UI timezone for users in the domain.

wm_domainalias

Optional

If set to true, Webmail will offer users different From addresses based on domain aliases.

workgroup

Optional

The default workgroup to which new accounts in the domain will belong.

Metadata fields

The following fields may be returned in the metadata array:

Field name

Obligation

Obligation

bulletins

Returned if domain exists

A hash of the manual and auto bulletins that exist in the domain. Includes the following:

  • count — The number of users to whom the bulletin was delivered.

  • last — The last time (date and time) that the bulletin was sent.

  • mtime — The last time that the bulletin was sent, in UNIX Epoch time.

  • name — The name of the bulletin.

  • total — The number of users to whom the bulletin is being sent.

Note: If the bulletin job has completed, the values for count and total will be the same.

createtime

Returned if domain exists

The date and time when the domain was created, displayed in UNIX Epoch time.

defaults

Returned if domain doesn't exist but can be created

The default settings and values that will be applied to newly created domains.

Includes:

disabled, language, quota, quota_maximum, service_pop3, service_imap4, service_smtpin, service_smtprelay, service_smtprelay_webmail, service_webmail, timezone, and workgroup.

For an explanation of each of these settings, see the Attributes table above.

inherit

Returned if domain exists

The company level values that will be assigned if they are not explicity set for this domain. Includes the following:

  • brand — The Webmail brand for this domain.

  • default_password_encoding — The type of password hashing/encoding to be performed when OpenSRS receives an unencrypted password.

  • filterdelivery — The way in which spam messages are handled.

  • regen_passwords — If set to true, the next time a user logs in, their passwords will be converted to the encoding specified in

  • default_password_encoding

  • smtp_sent_limit — The number of messages that the domain is allowed to send in a 24 hour period.

  • spamfolder — The folder into which messages identified as spam will be delivered.

  • spamheader — The tag that is added to messages that are identified as spam.

  • spamtag — The value of this field is prepended to the subject of any message that is identified as spam.

  • spamlevel — The level of aggressiveness set for the spam filter.

options

Returned if domain exists

The list of settings that can be set or changed for a domain. Includes all available values for each setting to allow a UI client to populate a page of attributes and drop-down options. Allowed settings are brand, default_password_encoding, language, quota, quota_maximum, spamlevel, timezone, and workgroup.

For an explanation of each of these settings, see the Attributes table above.

Examples for get_domain

Example 1

Retrieves settings and information for an existing domain.

Request

{
    "credentials":{
        "user": "[email protected]",
        "password": "seekrit"
    }
    "domain": [
        "example.com",
    ] 
}

Response

{
  "success": true,
  "settable_attributes": [
    "aliases",
    "allow",
    "block",
    "brand",
    "default_password_encoding”,
    "disabled",
    "filterdelivery",
    "filtermx",
    "language",
    "limit_aliases",
    "limit_users",
    "notes_external",
    "quota",
    "quota_maximum",
    "regen_passwords”,
    "service_imap4",
    "service_pop3",
    "service_smtpin",
    "service_smtprelay",
    "service_smtprelay_webmail",
    "service_webmail",
    "spamfolder",
    "spamheader",
    "spamlevel",
    "spamtag",
    "stats_mailout",
    "timezone",
    "wm_domainalias",
    "workgroup"
  ],
  "metadata": {
  "options": {
    "quota": [
      0,
      15360 
    ],
    "default_password_encoding": [
      null,
      "MD5",
      "SSHA224",
      "SSHA256",
      "SSHA384",
      "SSHA512",
      "BCRYPT-6",
      "BCRYPT-8",
      "BCRYPT-10",
      "BCRYPT-12"
    ],
    "workgroup": [
      "contract",
      "interns",
      "sales",
      "sales_europe",
      "staff",
      "stock_holders",
      "sysadmins"
    ],
    "quota_maximum": [
      0,
      15360 
    ],
    "timezone": [
    "Pacific/Wake",
    "Pacific/Niue",
    "Pacific/Honolulu",
    "America/Anchorage",
    "America/Vancouver",
    "America/Edmonton",
    "America/Phoenix",
    "America/Chicago",
    "America/Mexico_City",
    "America/Guatemala",
    "America/Montreal",
    "America/Havana",
    "America/Lima",
    "America/Caracas",
        "America/Halifax",
        "America/Asuncion",
        "America/Santiago",
        "America/Puerto_Rico",
        "America/La_Paz",
        "America/St_Johns",
        "America/Sao_Paulo",
        "America/Montevideo",
        "America/Buenos_Aires",
        "America/Noronha",
        "Atlantic/South_Georgia",
        "Atlantic/Azores",
        "Atlantic/Cape_Verde",
        "Europe/London",
        "Africa/Casablanca",
        "Atlantic/Reykjavik",
        "Europe/Amsterdam",
        "Africa/Algiers",
        "Asia/Beirut",
        "Europe/Helsinki",
        "Europe/Minsk",
        "Europe/Istanbul",
        "Asia/Amman",
        "Asia/Damascus",
        "Asia/Jerusalem",
        "Africa/Cairo",
        "Africa/Johannesburg",
        "Europe/Moscow",
        "Asia/Baghdad",
        "Asia/Tehran",
        "Asia/Baku",
        "Asia/Dubai",
    "Indian/Mauritius",
    "Asia/Kabul",
    "Asia/Karachi",
    "Asia/Colombo",
    "Asia/Calcutta",
    "Asia/Kathmandu",
    "Asia/Dhaka",
    "Asia/Rangoon",
    "Asia/Bangkok",
    "Asia/Phnom_Penh",
    "Asia/Hong_Kong",
    "Australia/Perth",
    "Asia/Tokyo",
    "Australia/Adelaide",
    "Australia/Darwin",
    "Australia/Melbourne",
    "Australia/Brisbane",
    "Australia/Lord_Howe",
    "Pacific/Guadalcanal",
    "Pacific/Norfolk",
    "Pacific/Fiji",
    "Pacific/Auckland",
    "Asia/Anadyr",
    "Pacific/Chatham",
    "Pacific/Tongatapu",
    "Pacific/Kiritimati"
  ],
  "language": [
    "el",
    "en",
    "es",
    "fr",
    "de",
    "it",
    "pt_BR",
    "nl",
    "da",
    "no",
    "sv"
  ],  
  "brand": [
    null,
    "Default Brand",
    "Example Co Brand"
  ],
   "spamlevel": [
     null,
     "Very High",
     "High",
     "Normal"
   ] 
 },
 "bulletins": {
   "manual": [],
   "auto": [
           {
             "count": "8",
             "mtime": 1325878560,
             "last": "Fri Jan 6 19:52:24 2012",
             "name": "Welcome Message",
             "total": "8"
           }
           ]
 },
 "createtime": "1321901972"
},
"attributes": {
  "quota": 5120,
  "disabled": false,
  "quota_maximum": 15360,
  "spamfolder": null,
  "service_smtprelay": "enabled", 
  "spamheader": null,
  "brand": null,
    "catchall": null,
    "service_smtpin": "enabled", 
    "filterdelivery": null,
    "company": "Example Corp", 
  "limit_users": null,
    "filtermx": null,
    "service_imap4": "enabled", 
  "wm_domainalias": null,
    "language": "en",
    "password": null,
    "timezone": "America/Montreal", 
  "smtp_sent_limit": null, 
  "regen_passwords": true, 
  "default_password_encoding":"BCRYPT-12", 
  "account": "example.com", 
  "service_pop3": "enabled",
    "workgroup": "staff", 
  "service_smtprelay_webmail": "enabled", 
  "spamtag": null,
    "aliases": [
    "schmemoco.com"
  ],
    "allow": [
    "*@example.com",
    "[email protected]"
],
"block": [],
"limit_aliases": null,
"service_webmail": "enabled",
"stats_mailout": [],
"notes_external": "Gold support for this domain",

Example 2

Retrieves information and settings for a domain that does not exist but that the admin can create.

Request

{
  "credentials": {
    "user": "[email protected]",
    "password": "sw0rdf1sh"
  },
  "domain": "example3.com"
}

Response

{
  "success": false,
  "settable_attributes": [
    "aliases",
    "allow",
    "block",
    "brand",
    "default_password_encoding",
    "disabled",
    "filterdelivery",
    "filtermx",
    "language",
    "limit_aliases",
    "limit_users",
    "notes_external",
    "quota",
    "quota_maximum",
    "regen_passwords",
    "service_imap4",
    "service_pop3",
    "service_smtpin",
    "service_smtprelay",
    "service_smtprelay_webmail",
    "service_webmail",
    "spamfolder",
    "spamheader",
    "spamlevel",
    "spamtag",
    "stats_mailout",
    "timezone",
    "wm_domainalias",
    "workgroup"
  ],
  "error_number": 2,
  "error": "The requested object does not exist", 
  "metadata": {
  "options": {
    "quota": [
      0,
      1048576 
    ],
    "workgroup": [],
    "quota_maximum": [
      0,
      15360 
    ],
    "timezone": [
      "Pacific/Wake",
      "Pacific/Niue",
      "Pacific/Honolulu",
      "America/Anchorage",
      "America/Vancouver",
      "America/Edmonton",
      "America/Phoenix",
      "America/Chicago",
            "America/Mexico_City",
            "America/Guatemala",
            "America/Montreal",
            "America/Havana",
            "America/Lima",
            "America/Caracas",
            "America/Halifax",
            "America/Asuncion",
            "America/Santiago",
            "America/Puerto_Rico",
            "America/La_Paz",
            "America/St_Johns",
            "America/Sao_Paulo",
            "America/Montevideo",
            "America/Buenos_Aires",
            "America/Noronha",
            "Atlantic/South_Georgia",
            "Atlantic/Azores",
            "Atlantic/Cape_Verde",
            "Europe/London",
            "Africa/Casablanca",
            "Atlantic/Reykjavik",
            "Europe/Amsterdam",
            "Africa/Algiers",
            "Asia/Beirut",
            "Europe/Helsinki",
            "Europe/Minsk",
            "Europe/Istanbul",
            "Asia/Amman",
            "Asia/Damascus",
            "Asia/Jerusalem",
            "Africa/Cairo",
            "Africa/Johannesburg",
            "Europe/Moscow",
       "Asia/Baghdad",
        "Asia/Tehran",
        "Asia/Baku",
        "Asia/Dubai",
        "Indian/Mauritius",
        "Asia/Kabul",
        "Asia/Karachi",
        "Asia/Colombo",
        "Asia/Calcutta",
        "Asia/Kathmandu",
        "Asia/Dhaka",
        "Asia/Rangoon",
        "Asia/Bangkok",
        "Asia/Phnom_Penh",
        "Asia/Hong_Kong",
        "Australia/Perth",
        "Asia/Tokyo",
        "Australia/Adelaide",
        "Australia/Darwin",
        "Australia/Melbourne",
        "Australia/Brisbane",
        "Australia/Lord_Howe",
        "Pacific/Guadalcanal",
        "Pacific/Norfolk",
        "Pacific/Fiji",
        "Pacific/Auckland",
        "Asia/Anadyr",
        "Pacific/Chatham",
        "Pacific/Tongatapu",
        "Pacific/Kiritimati"
    ],
    "language": [
        "el",
        "en",
        "es",
      "fr",
        "de",
        "it",
        "pt_BR",
        "nl",
        "da",
        "no",
        "sv"
    ],
    "default_password_encoding": [
      null,
      "MD5",
        "SSHA224",
        "SSHA256",
        "SSHA384",
        "SSHA512",
        "BCRYPT-6",
        "BCRYPT-8",
        "BCRYPT-10",
        "BCRYPT-12"
    ], 
    "brand": [
        null,
        "Default Brand",
        "Example Co Brand"
    ],
    "spamlevel": [
      null,
      "Very High",
      "High",
        "Normal"
        ] 
    },
    "defaults": {
    "service_imap4": "enabled",
    "quota": 5120,
        "disabled": false,
        "quota_maximum": 15360,
        "timezone": "America/Montreal", 
    "language": "en",
        "service_smtprelay": "enabled", 
    "service_pop3": "enabled",
        "workgroup": "staff", 
    "service_smtprelay_webmail": "enabled", 
    "service_smtpin": "enabled", 
    "service_webmail": "enabled"
  } 
 }
}