{"_id":"56b226677ae4550d00062954","__v":35,"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":"","user":"5582e90181672a3900bb4fc7","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"},"project":"569f9cf6650e1d1900f96b5b","parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-02-03T16:10:15.253Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"settings":"","examples":{"codes":[]},"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":9,"body":"## Syntax \n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"{\\n <credentials object> \\n \\\"criteria\\\": {\\n\\t\\t\\t\\t\\\"company\\\": <company>,\\n\\t\\t\\t\\t\\\"type\\\": [<domain and/or alias], \\n \\\"match\\\": <wildcard pattern>, \\n \\\"deleted\\\": true | false\\n }\\n\\t\\t\\\"range\\\": {\\n\\t\\t\\t\\t\\\"first\\\": <number>,\\n\\t\\t\\t\\t\\\"limit\\\": <number> \\n \\\"sort\\\": {\\n\\t\\t\\t\\t\\\"by\\\": delete_time | domain | id | type | users | users/filter |\\nusers/forward | users/mailbox | users/alias | users/deleted,\\n \\\"direction\\\": ascending | descending\\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 search_domains\"\n}\n[/block]\nThe following fields can be used in the **search_domains** method:\n[block:parameters]\n{\n \"data\": {\n \"h-0\": \"Field name\",\n \"h-1\": \"Obligation\",\n \"h-2\": \"Definition/Value\",\n \"0-0\": \"criteria\",\n \"0-1\": \"Optional\",\n \"0-2\": \"Narrows the results by restricting the search to the specified fields and their values.\\n\\nAllowed values are:\\n\\n * **company** — The company to search for domains. If not specified, the requestor's company is used.\\n\\n * **deleted** — If set to **true**, only deleted domains are returned; if set to **false** or not specified, only existing domains are returned. \\n\\n* **match** — Returns only those domains that match the specified pattern. You can use the following wildcards:\\n * **?** ― Match a single character\\n * ***** ― Match a string of characters.\\n \\n* **type** — Returns only domains of the specified\\ntype. Allowed values are:\\n\\n * **domain** — Regular domains \\n \\n * **alias** — Alias domains\",\n \"1-0\": \"range\",\n \"1-1\": \"Optional\",\n \"1-2\": \"Limits the range of domains to display. \\n\\nAllowed values are:\\n\\n * **first** — Specify the first domain to return; the default is the first result.\\n \\n * **limit** — Specify the maximum number of results to return.\",\n \"2-0\": \"sort\",\n \"2-1\": \"Optional\",\n \"2-2\": \"Determines the way in which to sort and display results. \\n\\nAllowed values are:\\n\\n * **by** — Specify the attribute to use to sort results. Allowed values are: \\n * **delete_time** — The time the domain was deleted. Can be used only if **criteria = deleted**.\\n * **domain** — The domain name (this is the default).\\n * **id** — The identification number of the domain.\\n * **type** — The domain type: domain or alias.\\n * **users** — The number of users in the domain. You can refine this to specify the number of users of a certain mailbox type by using one of the following: **users/alias**, **users/deleted**, **users/filter**, **users/forward**, or **users/mailbox**.\\n \\n * **direction** — Specify the sort order. Allowed values are **ascending** (this is the default) or **descending**.\"\n },\n \"cols\": 3,\n \"rows\": 3\n}\n[/block]\n\n[block:api-header]\n{\n \"type\": \"basic\",\n \"title\": \"Response fields for search_domains\"\n}\n[/block]\nThe following fields may be returned when the **search_domains** method is submitted:\n[block:parameters]\n{\n \"data\": {\n \"h-0\": \"Field name\",\n \"h-1\": \"Obligation\",\n \"h-2\": \"Description/Value\",\n \"0-0\": \"count\",\n \"0-1\": \"Returned if **success = true**\",\n \"0-2\": \"The number of domains returned.\",\n \"1-0\": \"domains\",\n \"1-1\": \"Returned if **success = true**\",\n \"1-2\": \"A list of the domains that meet the criteria, and, optionally, their attributes. \\n\\nAllowed values are:\\n\\n * **alias_target**—The domain for which this name is an alias. Returned only if the domain is an alias.\\n\\n * **counts**—The number of each of the different mailbox types in the domain.\\n\\n * **domain**—A list of the domains that meet the search criteria.\\n \\n * **id**—The identification number of the account. Returned only if deleted = true in the request.\\n\\n * **type**—The type of domain. May be one of the following: \\n * **alias**—An alias name for another domain.\\n * **domain**—Regular domain.\",\n \"2-0\": \"error\",\n \"2-1\": \"Returned if **success = false**\",\n \"3-1\": \"Returned if **success = false**\",\n \"2-2\": \"A text string that explains the error.\",\n \"3-0\": \"error_number\",\n \"3-2\": \"A number that represents the error.\",\n \"4-0\": \"success\",\n \"4-1\": \"Always returned\",\n \"4-2\": \"Indicates whether the request was successful or not. Allowed values are **true** and **false**.\",\n \"5-0\": \"total_count\",\n \"5-1\": \"Returned if **success = true**\",\n \"5-2\": \"The total number of domains that match the search criteria. This value may be more than the number of results returned if a **range** was specified in the request.\"\n },\n \"cols\": 3,\n \"rows\": 6\n}\n[/block]\n\n[block:api-header]\n{\n \"type\": \"basic\",\n \"title\": \"Examples for search_domains\"\n}\n[/block]\n## Example 1\n\nRetrieves all domains in the requestor's company.\n\n**Request** \n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"{\\n \\\"credentials\\\": {\\n \\\"user\\\": \\\"company_admin:::at:::example.adm\\\",\\n \\\"password\\\": \\\"sw0rdf1sh\\\"\\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 \\\"domains\\\": [\\n {\\n \\\"domain\\\": \\\"example.adm\\\",\\n \\\"type\\\": \\\"domain\\\",\\n \\\"counts\\\": {\\n \\\"filter\\\": 0,\\n \\\"forward\\\": 0,\\n \\\"deleted\\\": 0,\\n \\\"mailbox\\\": 1,\\n \\\"total\\\": 1,\\n \\\"alias\\\": 0\\n\\t\\t\\t}\\n\\t},\\n {\\n \\\"domain\\\": \\\"example.com\\\",\\n \\\"type\\\": \\\"domain\\\",\\n \\\"counts\\\": {\\n \\\"filter\\\": 0,\\n \\\"forward\\\": 2,\\n \\\"deleted\\\": 1,\\n \\\"mailbox\\\": 7,\\n\\t\\t\\t\\t\\\"total\\\": 10,\\n\\t\\t\\t\\t\\\"alias\\\": 1\\n\\t\\t\\t} \\n\\t\\t},\\n\\t{\\n\\t\\t\\t\\\"domain\\\": \\\"example2-restored.com\\\", \\n \\\"type\\\": \\\"domain\\\",\\n\\t\\t\\t\\\"counts\\\": {\\n \\t\\t\\\"filter\\\": 0,\\n \\t\\t\\\"forward\\\": 0,\\n \\t\\t\\\"deleted\\\": 0,\\n \\t\\t\\\"mailbox\\\": 0,\\n \\t\\t\\\"total\\\": 0,\\n \\t\\t\\\"alias\\\": 0\\n\\t\\t\\t} \\n\\t\\t},\\n\\t\\t{\\n \\t\\t\\\"domain\\\": \\\"othermail.com\\\",\\n \\t\\t\\\"type\\\": \\\"domain\\\",\\n \\t\\t\\\"counts\\\": {\\n \\t\\t\\\"filter\\\": 0,\\n \\t\\t\\\"forward\\\": 0,\\n \\t\\t\\\"deleted\\\": 0,\\n \\t\\t\\\"mailbox\\\": 1,\\n \\t\\t\\\"total\\\": 1,\\n \\t\\t\\\"alias\\\": 0\\n\\t\\t\\t} \\n\\t\\t},\\n\\t\\t{\\n \\t\\t\\\"domain\\\": \\\"schmexample.com\\\",\\n \\t\\t\\\"alias_target\\\": \\\"example.com\\\",\\n \\t\\t\\\"type\\\": \\\"alias\\\"\\n \\t\\t\\\"counts\\\": {\\n\\t\\t\\t\\t\\\"filter\\\": 0,\\n \\\"forward\\\": 0,\\n \\\"deleted\\\": 0,\\n \\\"mailbox\\\": 0,\\n \\\"total\\\": 0,\\n \\\"alias\\\": 0\\n\\t\\t\\t} \\n\\t\\t}\\n ],\\n \\\"count\\\": 5,\\n \\\"total_count\\\": 5\\n}\\n\",\n \"language\": \"perl\",\n \"name\": \" \"\n }\n ]\n}\n[/block]\n## Example 2\n\nRetrieves all domains in the requestor's company that start with 'd', sorted by number of users in the domain.\n\n**Request** \n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"{\\n \\\"credentials\\\": {\\n \\\"user\\\": \\\"company_admin@democo.adm\\\",\\n \\\"password\\\": \\\"sw0rdf1sh\\\"\\n },\\n \\\"criteria\\\": {\\n \\\"match\\\": \\\"d*\\\"\\n },\\n \\\"sort\\\": {\\n \\\"by\\\": \\\"users\\\"\\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 \\\"domains\\\": [\\n\\t\\t{\\n\\t\\t\\t\\\"domain\\\": \\\"example2-restored.com\\\", \\n \\\"type\\\": \\\"domain\\\",\\n \\\"counts\\\": {\\n \\t\\\"filter\\\": 0,\\n \\t\\\"forward\\\": 0,\\n \\t\\\"deleted\\\": 0,\\n \\t\\\"mailbox\\\": 0,\\n \\t\\\"total\\\": 0,\\n \\t\\\"alias\\\": 0\\n } \\n },\\n \\t{\\n \\t\\\"domain\\\": \\\"example.adm\\\",\\n \\t\\\"type\\\": \\\"domain\\\",\\n \\t\\\"counts\\\": {\\n \\t\\\"filter\\\": 0,\\n \\t\\\"forward\\\": 0,\\n \\t\\\"deleted\\\": 0,\\n \\t\\\"mailbox\\\": 1,\\n \\t\\\"total\\\": 1,\\n \\t\\\"alias\\\": 0\\n } \\n },\\n {\\n \\t\\\"domain\\\": \\\"example.com\\\",\\n \\t\\\"type\\\": \\\"domain\\\",\\n \\t\\\"counts\\\": {\\n \\t\\\"filter\\\": 0,\\n \\t\\\"forward\\\": 2,\\n \\t\\\"deleted\\\": 1,\\n \\t\\\"mailbox\\\": 7,\\n \\t\\\"total\\\": 10,\\n \\t\\\"alias\\\": 1\\n\\t\\t\\t} \\n \\t}\\n\\t],\\n \\\"count\\\": 3,\\n \\\"total_count\\\": 3\\n}\",\n \"language\": \"perl\",\n \"name\": \" \"\n }\n ]\n}\n[/block]\n## Example 3\n\nRetrieves all regular .com domains in the requestor's company\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 \\\"criteria\\\": {\\n \\\"match\\\": \\\"*.com\\\",\\n \\\"type\\\": [\\n \\\"domain\\\"\\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 \\\"domains\\\": [\\n {\\n \\\"domain\\\": \\\"example.adm\\\",\\n \\\"type\\\": \\\"domain\\\",\\n \\\"counts\\\": {\\n \\\"filter\\\": 0,\\n \\\"forward\\\": 0,\\n \\\"deleted\\\": 0,\\n \\\"mailbox\\\": 1,\\n \\\"total\\\": 1,\\n \\\"alias\\\": 0\\n\\t\\t\\t} \\n\\t\\t}\\n {\\n \\t\\t\\\"domain\\\": \\\"example.com\\\",\\n \\t\\t\\\"type\\\": \\\"domain\\\",\\n \\t\\t\\\"counts\\\": {\\n \\t\\t\\\"filter\\\": 0,\\n \\t\\t\\\"forward\\\": 2,\\n \\t\\t \\\"deleted\\\": 1,\\n \\t\\t\\\"mailbox\\\": 7,\\n \\t\\t\\\"total\\\": 10,\\n \\t\\t\\\"alias\\\": 1\\n\\t\\t\\t} \\n\\t\\t}\\n\\t\\t{\\n\\t\\t\\t\\\"domain\\\": \\\"example2-restored.com\\\", \\n \\t\\t\\\"type\\\": \\\"domain\\\",\\n\\t\\t\\t\\\"counts\\\": {\\n \\t\\t \\t\\\"filter\\\": 0,\\n \\t\\t\\\"forward\\\": 0,\\n \\t\\t\\\"deleted\\\": 0,\\n \\t\\t\\\"mailbox\\\": 0,\\n \\t\\t\\\"total\\\": 0,\\n \\t\\t\\\"alias\\\": 0\\n\\t\\t\\t} \\n\\t\\t}\\n\\t\\t{\\n \\t\\t\\\"domain\\\": \\\"othermail.com\\\",\\n \\t\\t\\\"type\\\": \\\"domain\\\",\\n \\t\\t\\\"counts\\\": {\\n \\t\\t\\\"filter\\\": 0,\\n \\t\\t\\\"forward\\\": 0,\\n \\t\\t\\\"deleted\\\": 0,\\n \\t\\t\\\"mailbox\\\": 1,\\n \\t\\t\\\"total\\\": 1,\\n \\t\\t\\\"alias\\\": 0\\n\\t\\t\\t}\\n\\t\\t} \\n\\t],\\n\\t\\\"count\\\": 4,\\n \\\"total_count\\\": 4\\n}\",\n \"language\": \"perl\",\n \"name\": \" \"\n }\n ]\n}\n[/block]","excerpt":"The **search_domains** method retrieves a list of domains in a company.","slug":"search_domains","type":"basic","title":"search_domains"}
search_domains
The **search_domains** method retrieves a list of domains in a company.