{"_id":"56b00b9d3c70b01700facf6a","user":"5582e90181672a3900bb4fc7","version":{"_id":"569f9cf6650e1d1900f96b5e","project":"569f9cf6650e1d1900f96b5b","__v":12,"createdAt":"2016-01-20T14:43:02.785Z","releaseDate":"2016-01-20T14:43:02.785Z","categories":["569f9cf7650e1d1900f96b5f","56abdd81d4432d1900eed235","56abe0558beeff0d003b8118","56ad2f8b1c09150d00a183a8","56ad4e1cd21f1b0d00fd2f97","56b00ad88f7a4f0d0029dc92","56b2432e9621f20d00efb2bd","56b25826147e900d00d6497a","56b7af2a4b372d2100722c48","56b8c4d938b1070d0028920f","56b8cdab14feef0d0082415d","58599813cf9e112d0032cdab"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"githubsync":"","__v":52,"project":"569f9cf6650e1d1900f96b5b","category":{"_id":"56b00ad88f7a4f0d0029dc92","version":"569f9cf6650e1d1900f96b5e","project":"569f9cf6650e1d1900f96b5b","__v":10,"pages":["56b00b4d3c70b01700facf68","56b00b9d3c70b01700facf6a","56b016f43a5b810d00745dca","56b0e8cabf040b0d00588a96","56b0ef73135ec20d00baf9b8","56b21ce83b6f690d00bdb6b6","56b21ea99621f20d00efb273","56b22157a5a1020d00cf4c60","56b224b29621f20d00efb287","56b226677ae4550d00062954"],"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-02-02T01:48:08.558Z","from_sync":false,"order":5,"slug":"domain-methods","title":"Domain methods"},"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-02-02T01:51:25.598Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","examples":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"## Syntax \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    <credentials object>, \\n    \\\"domains\\\": <domain> \\n    \\\"attributes\\\":\\n      {\\n        <key value pairs>\\n      }, \\n   }\\n}\\n\",\n      \"language\": \"perl\",\n      \"name\": \"  \"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Request fields for change_domain\"\n}\n[/block]\nRequest fields for **change_domain** method:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field name\",\n    \"h-1\": \"Obligation\",\n    \"h-2\": \"Definition/Value\",\n    \"0-0\": \"attributes\",\n    \"0-1\": \"Required\",\n    \"0-2\": \"The list of fields that you want to configure and their values.\\n\\nFor more information, see the **Attributes** table below.\",\n    \"1-2\": \"Used to prevent changes to existing domains. If set to **true** and the specified domain exists, the domain will not be modified and an error will be returned.\",\n    \"1-0\": \"create_only\",\n    \"1-1\": \"Optional\",\n    \"2-0\": \"domain\",\n    \"2-1\": \"Required\",\n    \"2-2\": \"The domain that you want to create or change.\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\n## Attributes fields \n\nYou can specify the following fields within the **attributes array**.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field name\",\n    \"h-1\": \"Obligation\",\n    \"h-2\": \"Definition/Value\",\n    \"0-0\": \"aliases\",\n    \"0-1\": \"Optional\",\n    \"0-2\": \"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 joe_user:::at:::example- corporation.com will be delivered to joe_user@example.com The maximum number of aliases is 2000.\",\n    \"1-0\": \"allow\",\n    \"1-1\": \"Optional\",\n    \"1-2\": \"A list of senders whose messages are not scanned for spam; may include wildcards. For example joe_goodguy@bigmail.com and *@example.com. Maximum is 1000 addresses.\",\n    \"2-0\": \"block\",\n    \"2-1\": \"Optional\",\n    \"2-2\": \"A list of email addresses whose messages will always be identified as spam; may include wildcards. For example, bob_thejerk@othermail.com and *@spammers- inc.com. Messages from these addresses will always be considered to be spam. Maximum is 1000 addresses.\",\n    \"3-0\": \"brand\",\n    \"3-1\": \"Optional\",\n    \"3-2\": \"The default brand used for mailboxes in the domain. If undefined, the company brand is used.\",\n    \"4-0\": \"catchall\",\n    \"4-1\": \"Optional\",\n    \"4-2\": \"If set, any mail sent to a mailbox in the domain that does not exist will be sent to the specified mailbox.\\n\\n**Note**: This feature cannot be enabled for new domains.\",\n    \"5-0\": \"default_ password_encoding\",\n    \"5-1\": \"Optional\",\n    \"5-2\": \"The type of password hashing/encoding to be performed when OpenSRS receives an unencrypted password to store for a user. We recommend BCRYPT encoding.\",\n    \"6-0\": \"disabled\",\n    \"6-1\": \"Optional\",\n    \"6-2\": \"If set to **true**, mailboxes in the domain will not function.\",\n    \"7-0\": \"filterdelivery\",\n    \"7-1\": \"Optional\",\n    \"7-2\": \"The way in which spam messages are handled by the OpenSRS email filter. \\n\\nAllowed values are:\\n\\n  * **quarantine** — Spam messages are stored locally in the user's spam folder.\\n  \\n  * **passthrough** — Spam messages are delivered with the specified **spamtag** and **spamheader**. \\n\\nIf undefined, the company's value is used.\",\n    \"8-0\": \"filtermx\",\n    \"8-1\": \"Optional\",\n    \"8-2\": \"The mail server (and optionally, SMTP port) to which messages received by filter users in this\\ndomain are sent after spam and virus scanning.\",\n    \"9-0\": \"language\",\n    \"9-1\": \"Optional\",\n    \"9-2\": \"The default Webmail UI language for new users in the domain. May be overridden by the user.\\n\\nA list of valid languages is displayed in the **metadata** ->**options** field in the [get_domain](https://api-opensrs-email.readme.io/v1.0/docs/get_domain?bypass=8272e34bb5)  response.\",\n    \"10-0\": \"limit_aliases\",\n    \"10-1\": \"Optional\",\n    \"10-2\": \"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.\",\n    \"11-0\": \"limit_users\",\n    \"11-1\": \"Optional\",\n    \"11-2\": \"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.\",\n    \"12-0\": \"notes_external\",\n    \"12-1\": \"Optional\",\n    \"12-2\": \"Any notes you want to add to the domain. Maximum is 4096 characters.\",\n    \"13-0\": \"quota\",\n    \"13-1\": \"Optional\",\n    \"13-2\": \"The default maximum amount of storage (in bytes) that new mailboxes may use, including mail and file storage.\",\n    \"14-0\": \"quota_maximum\",\n    \"14-1\": \"Optional\",\n    \"14-2\": \"The default maximum quota (in Megabytes) that can be assigned to any mailbox in the domain.\",\n    \"15-0\": \"regen_passwords\",\n    \"15-1\": \"Optional\",\n    \"15-2\": \"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**).\",\n    \"17-0\": \"service_imap4\",\n    \"17-1\": \"Optional\",\n    \"17-2\": \"The default setting for new users for the IMAP4 service (**enabled**, **disabled**, or **suspended**). If **enabled**, new users can log in via IMAP4.\",\n    \"18-0\": \"service_pop3\",\n    \"18-1\": \"Optional\",\n    \"18-2\": \"The default setting for new users for the POP3 service (**enabled**, **disabled**, or **suspended**). If **enabled**, new users can log in via POP3.\",\n    \"19-0\": \"service_smtpin\",\n    \"19-1\": \"Optional\",\n    \"19-2\": \"The default setting for new users for the SMTPIN service (**enabled**, **disabled**, or **suspended**). If **enabled**, new users can send email.\",\n    \"20-0\": \"service_ smtprelay\",\n    \"20-1\": \"Optional\",\n    \"20-2\": \"The default setting for new users for the SMTPRELAY service (**enabled**, **disabled**, or **suspended**).\",\n    \"21-0\": \"service_smtprelay_webmail\",\n    \"21-1\": \"Optional\",\n    \"21-2\": \"The default setting for new users for the SMTPRELAY Webmail service (**enabled**, **disabled**, or **suspended**). If **enabled**, new users can send email via Webmail.\",\n    \"22-0\": \"service_webmail\",\n    \"22-1\": \"Optional\",\n    \"22-2\": \"The default setting for new users for the Webmail service (**enabled**, **disabled**, or **suspended**). If enabled, new users can log in via Webmail.\",\n    \"23-0\": \"smtp_sent_limit\",\n    \"23-1\": \"Optional\",\n    \"23-2\": \"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.\",\n    \"24-0\": \"spamfolder\",\n    \"24-1\": \"Optional\",\n    \"24-2\": \"The folder to which messages that have been identified as spam are delivered. Maximum 128 characters.\",\n    \"25-0\": \"spamheader\",\n    \"25-1\": \"Optional\",\n    \"25-2\": \"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. Maximum 512 characters.\",\n    \"26-0\": \"spamlevel\",\n    \"26-1\": \"Optional\",\n    \"26-2\": \"The level of aggressiveness for spam filtering. Allowed values are: **Normal**, **High**, and **Very High**.\",\n    \"27-0\": \"spamtag\",\n    \"27-1\": \"Optional\",\n    \"27-2\": \"The tag that is appended to an email message to identify it as spam. Maximum 30 characters.\",\n    \"28-0\": \"timezone\",\n    \"28-1\": \"Optional\",\n    \"28-2\": \"The default Webmail UI timezone for users in this domain.\\n\\nA list of valid timezones is displayed in the **metadata** ->**options** field in the [get_domain](https://api-opensrs-email.readme.io/v1.0/docs/get_domain?bypass=8272e34bb5) response.\",\n    \"29-0\": \"wm_domainalias\",\n    \"29-1\": \"Optional\",\n    \"29-2\": \"If set to **true**, Webmail will offer users different **From** addresses based on domain aliases.\",\n    \"30-0\": \"workgroup\",\n    \"30-1\": \"Optional\",\n    \"30-2\": \"The default workgroup to which new accounts in the domain will belong.\",\n    \"16-0\": \"password_strength\",\n    \"16-1\": \"Optional\",\n    \"16-2\": \"The minimum level at which the password strength checks must pass (see change_user).\\n\\nValid values are null, \\\"weak\\\", \\\"medium\\\", \\\"good\\\", and \\\"strong\\\".\\n\\nIf set to null, the value will be inherited from the company level.\",\n    \"31-0\": \"dkim_selector\",\n    \"31-1\": \"Optional\",\n    \"31-2\": \"A selector generated with your private DKIM record.\\nThis is required if attribute dkim_key is specified.\",\n    \"32-0\": \"dkim_key\",\n    \"32-1\": \"Optional\",\n    \"32-2\": \"Your private dkim key generated with your selector.\\nThis is required if attribute dkim_selector is specified.\\n\\nImportant: Every line break in the dkim key must be denoted with newline control character '\\\\n'\"\n  },\n  \"cols\": 3,\n  \"rows\": 33\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Response fields for change_domain\"\n}\n[/block]\n The following fields may be returned in response to the **change_domain**\nmethod:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field name\",\n    \"h-1\": \"Field name\",\n    \"h-2\": \"Description/Value\",\n    \"0-0\": \"error\",\n    \"0-1\": \"Returned if **success = false**\",\n    \"0-2\": \"A text string that explains the error.\",\n    \"1-0\": \"error_number\",\n    \"1-1\": \"Returned if **success = false**\",\n    \"2-1\": \"Returned if **success = false**\",\n    \"1-2\": \"A number that represents the error.\",\n    \"2-0\": \"hints\",\n    \"2-2\": \"Lists one or more attributes that had errors and suggests a possible cause of each error.\",\n    \"3-0\": \"success\",\n    \"3-1\": \"Always returned\",\n    \"3-2\": \"Indicates whether the request was successful or not. Allowed values are **true** and **false**.\"\n  },\n  \"cols\": 3,\n  \"rows\": 4\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Examples for change_domain\"\n}\n[/block]\n## Example 1 \n\nChanges the **allow** attribute.\n\n**Request** \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"credentials\\\": {\\n    \\\"user\\\": \\\"company_admin@example.adm\\\",\\n    \\\"password\\\": \\\"sw0rdf1sh\\\"\\n  },\\n  \\\"domain\\\": \\\"example.com\\\",\\n  \\\"attributes\\\": {\\n    \\\"allow\\\": [\\n      \\\"*@example.com\\\",\\n      \\\"important_stuff@otherco.com\\\"\\n    ] \\n  }\\n}\",\n      \"language\": \"perl\",\n      \"name\": \"  \"\n    }\n  ]\n}\n[/block]\n**Response** \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"success\\\": true\\n}\",\n      \"language\": \"perl\",\n      \"name\": \"  \"\n    }\n  ]\n}\n[/block]\n## Example 2\n\nAdds a note to the domain\n\n**Request** \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"credentials\\\": {\\n    \\\"user\\\": \\\"company_admin@example.adm\\\",\\n    \\\"password\\\": \\\"sw0rdf1sh\\\"\\n  },\\n  \\\"domain\\\": \\\"example.com\\\",\\n  \\\"attributes\\\": {\\n    \\\"notes_external: \\\"Has not paid.\\\\nDo NOT enable without consulting \\nFinance.\\\"\\n  } \\n}\",\n      \"language\": \"perl\",\n      \"name\": \"  \"\n    }\n  ]\n}\n[/block]\n**Response** \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"success\\\": true\\n}\",\n      \"language\": \"perl\",\n      \"name\": \"  \"\n    }\n  ]\n}\n[/block]\n## Example 3\n\nAttempts to create a domain that already exists (with **create_only** flag)\n\n**Request** \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"attributes\\\":{},\\n  \\\"domain\\\":\\\"gob.com\\\",\\n  \\\"create_only\\\":true,\\n  \\\"credentials\\\":{...}\\n}\",\n      \"language\": \"perl\",\n      \"name\": \"  \"\n    }\n  ]\n}\n[/block]\n**Response** \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"success\\\":false,\\n  \\\"error_number\\\":23,\\n  \\\"error\\\":\\\"Object already exists\\\",\\n  \\\"audit\\\":\\\"anger67_50c235f128\\\"\\n}\",\n      \"language\": \"perl\",\n      \"name\": \"  \"\n    }\n  ]\n}\n[/block]","excerpt":"The **change_domain** method creates a new domain or modifies the attributes of an existing domain.","slug":"change_domain","type":"basic","title":"change_domain"}

change_domain

The **change_domain** method creates a new domain or modifies the attributes of an existing domain.

## Syntax [block:code] { "codes": [ { "code": "{\n <credentials object>, \n \"domains\": <domain> \n \"attributes\":\n {\n <key value pairs>\n }, \n }\n}\n", "language": "perl", "name": " " } ] } [/block] [block:api-header] { "type": "basic", "title": "Request fields for change_domain" } [/block] Request fields for **change_domain** method: [block:parameters] { "data": { "h-0": "Field name", "h-1": "Obligation", "h-2": "Definition/Value", "0-0": "attributes", "0-1": "Required", "0-2": "The list of fields that you want to configure and their values.\n\nFor more information, see the **Attributes** table below.", "1-2": "Used to prevent changes to existing domains. If set to **true** and the specified domain exists, the domain will not be modified and an error will be returned.", "1-0": "create_only", "1-1": "Optional", "2-0": "domain", "2-1": "Required", "2-2": "The domain that you want to create or change." }, "cols": 3, "rows": 3 } [/block] ## Attributes fields You can specify the following fields within the **attributes array**. [block:parameters] { "data": { "h-0": "Field name", "h-1": "Obligation", "h-2": "Definition/Value", "0-0": "aliases", "0-1": "Optional", "0-2": "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 joe_user@example- corporation.com will be delivered to joe_user@example.com The maximum number of aliases is 2000.", "1-0": "allow", "1-1": "Optional", "1-2": "A list of senders whose messages are not scanned for spam; may include wildcards. For example joe_goodguy@bigmail.com and *@example.com. Maximum is 1000 addresses.", "2-0": "block", "2-1": "Optional", "2-2": "A list of email addresses whose messages will always be identified as spam; may include wildcards. For example, bob_thejerk@othermail.com and *@spammers- inc.com. Messages from these addresses will always be considered to be spam. Maximum is 1000 addresses.", "3-0": "brand", "3-1": "Optional", "3-2": "The default brand used for mailboxes in the domain. If undefined, the company brand is used.", "4-0": "catchall", "4-1": "Optional", "4-2": "If set, any mail sent to a mailbox in the domain that does not exist will be sent to the specified mailbox.\n\n**Note**: This feature cannot be enabled for new domains.", "5-0": "default_ password_encoding", "5-1": "Optional", "5-2": "The type of password hashing/encoding to be performed when OpenSRS receives an unencrypted password to store for a user. We recommend BCRYPT encoding.", "6-0": "disabled", "6-1": "Optional", "6-2": "If set to **true**, mailboxes in the domain will not function.", "7-0": "filterdelivery", "7-1": "Optional", "7-2": "The way in which spam messages are handled by the OpenSRS email filter. \n\nAllowed values are:\n\n * **quarantine** — Spam messages are stored locally in the user's spam folder.\n \n * **passthrough** — Spam messages are delivered with the specified **spamtag** and **spamheader**. \n\nIf undefined, the company's value is used.", "8-0": "filtermx", "8-1": "Optional", "8-2": "The mail server (and optionally, SMTP port) to which messages received by filter users in this\ndomain are sent after spam and virus scanning.", "9-0": "language", "9-1": "Optional", "9-2": "The default Webmail UI language for new users in the domain. May be overridden by the user.\n\nA list of valid languages is displayed in the **metadata** ->**options** field in the [get_domain](https://api-opensrs-email.readme.io/v1.0/docs/get_domain?bypass=8272e34bb5) response.", "10-0": "limit_aliases", "10-1": "Optional", "10-2": "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.", "11-0": "limit_users", "11-1": "Optional", "11-2": "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.", "12-0": "notes_external", "12-1": "Optional", "12-2": "Any notes you want to add to the domain. Maximum is 4096 characters.", "13-0": "quota", "13-1": "Optional", "13-2": "The default maximum amount of storage (in bytes) that new mailboxes may use, including mail and file storage.", "14-0": "quota_maximum", "14-1": "Optional", "14-2": "The default maximum quota (in Megabytes) that can be assigned to any mailbox in the domain.", "15-0": "regen_passwords", "15-1": "Optional", "15-2": "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**).", "17-0": "service_imap4", "17-1": "Optional", "17-2": "The default setting for new users for the IMAP4 service (**enabled**, **disabled**, or **suspended**). If **enabled**, new users can log in via IMAP4.", "18-0": "service_pop3", "18-1": "Optional", "18-2": "The default setting for new users for the POP3 service (**enabled**, **disabled**, or **suspended**). If **enabled**, new users can log in via POP3.", "19-0": "service_smtpin", "19-1": "Optional", "19-2": "The default setting for new users for the SMTPIN service (**enabled**, **disabled**, or **suspended**). If **enabled**, new users can send email.", "20-0": "service_ smtprelay", "20-1": "Optional", "20-2": "The default setting for new users for the SMTPRELAY service (**enabled**, **disabled**, or **suspended**).", "21-0": "service_smtprelay_webmail", "21-1": "Optional", "21-2": "The default setting for new users for the SMTPRELAY Webmail service (**enabled**, **disabled**, or **suspended**). If **enabled**, new users can send email via Webmail.", "22-0": "service_webmail", "22-1": "Optional", "22-2": "The default setting for new users for the Webmail service (**enabled**, **disabled**, or **suspended**). If enabled, new users can log in via Webmail.", "23-0": "smtp_sent_limit", "23-1": "Optional", "23-2": "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.", "24-0": "spamfolder", "24-1": "Optional", "24-2": "The folder to which messages that have been identified as spam are delivered. Maximum 128 characters.", "25-0": "spamheader", "25-1": "Optional", "25-2": "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. Maximum 512 characters.", "26-0": "spamlevel", "26-1": "Optional", "26-2": "The level of aggressiveness for spam filtering. Allowed values are: **Normal**, **High**, and **Very High**.", "27-0": "spamtag", "27-1": "Optional", "27-2": "The tag that is appended to an email message to identify it as spam. Maximum 30 characters.", "28-0": "timezone", "28-1": "Optional", "28-2": "The default Webmail UI timezone for users in this domain.\n\nA list of valid timezones is displayed in the **metadata** ->**options** field in the [get_domain](https://api-opensrs-email.readme.io/v1.0/docs/get_domain?bypass=8272e34bb5) response.", "29-0": "wm_domainalias", "29-1": "Optional", "29-2": "If set to **true**, Webmail will offer users different **From** addresses based on domain aliases.", "30-0": "workgroup", "30-1": "Optional", "30-2": "The default workgroup to which new accounts in the domain will belong.", "16-0": "password_strength", "16-1": "Optional", "16-2": "The minimum level at which the password strength checks must pass (see change_user).\n\nValid values are null, \"weak\", \"medium\", \"good\", and \"strong\".\n\nIf set to null, the value will be inherited from the company level.", "31-0": "dkim_selector", "31-1": "Optional", "31-2": "A selector generated with your private DKIM record.\nThis is required if attribute dkim_key is specified.", "32-0": "dkim_key", "32-1": "Optional", "32-2": "Your private dkim key generated with your selector.\nThis is required if attribute dkim_selector is specified.\n\nImportant: Every line break in the dkim key must be denoted with newline control character '\\n'" }, "cols": 3, "rows": 33 } [/block] [block:api-header] { "type": "basic", "title": "Response fields for change_domain" } [/block] The following fields may be returned in response to the **change_domain** method: [block:parameters] { "data": { "h-0": "Field name", "h-1": "Field name", "h-2": "Description/Value", "0-0": "error", "0-1": "Returned if **success = false**", "0-2": "A text string that explains the error.", "1-0": "error_number", "1-1": "Returned if **success = false**", "2-1": "Returned if **success = false**", "1-2": "A number that represents the error.", "2-0": "hints", "2-2": "Lists one or more attributes that had errors and suggests a possible cause of each error.", "3-0": "success", "3-1": "Always returned", "3-2": "Indicates whether the request was successful or not. Allowed values are **true** and **false**." }, "cols": 3, "rows": 4 } [/block] [block:api-header] { "type": "basic", "title": "Examples for change_domain" } [/block] ## Example 1 Changes the **allow** attribute. **Request** [block:code] { "codes": [ { "code": "{\n \"credentials\": {\n \"user\": \"company_admin@example.adm\",\n \"password\": \"sw0rdf1sh\"\n },\n \"domain\": \"example.com\",\n \"attributes\": {\n \"allow\": [\n \"*@example.com\",\n \"important_stuff@otherco.com\"\n ] \n }\n}", "language": "perl", "name": " " } ] } [/block] **Response** [block:code] { "codes": [ { "code": "{\n \"success\": true\n}", "language": "perl", "name": " " } ] } [/block] ## Example 2 Adds a note to the domain **Request** [block:code] { "codes": [ { "code": "{\n \"credentials\": {\n \"user\": \"company_admin@example.adm\",\n \"password\": \"sw0rdf1sh\"\n },\n \"domain\": \"example.com\",\n \"attributes\": {\n \"notes_external: \"Has not paid.\\nDo NOT enable without consulting \nFinance.\"\n } \n}", "language": "perl", "name": " " } ] } [/block] **Response** [block:code] { "codes": [ { "code": "{\n \"success\": true\n}", "language": "perl", "name": " " } ] } [/block] ## Example 3 Attempts to create a domain that already exists (with **create_only** flag) **Request** [block:code] { "codes": [ { "code": "{\n \"attributes\":{},\n \"domain\":\"gob.com\",\n \"create_only\":true,\n \"credentials\":{...}\n}", "language": "perl", "name": " " } ] } [/block] **Response** [block:code] { "codes": [ { "code": "{\n \"success\":false,\n \"error_number\":23,\n \"error\":\"Object already exists\",\n \"audit\":\"anger67_50c235f128\"\n}", "language": "perl", "name": " " } ] } [/block]