{"_id":"56b8cebd38b1070d00289220","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"},"user":"5582e90181672a3900bb4fc7","__v":14,"githubsync":"","project":"569f9cf6650e1d1900f96b5b","category":{"_id":"56b8cdab14feef0d0082415d","__v":5,"pages":["56b8cdd914feef0d0082415e","56b8cebd38b1070d00289220","56b8d26f38b1070d00289226","56b8d3a55d75fe0d00fbcca5","56b8d74d86d2b0190070bd7a"],"project":"569f9cf6650e1d1900f96b5b","version":"569f9cf6650e1d1900f96b5e","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-02-08T17:17:31.562Z","from_sync":false,"order":9999,"slug":"migration-methods","title":"Migration methods"},"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-02-08T17:22:05.990Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[]},"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"## Syntax \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\t\\t<credentials object>, \\n    \\\"job\\\": <job id>, \\n    \\\"users\\\":\\n\\t\\t\\t[\\n\\t\\t\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\"local\\\": <local email address user migrates to>, \\n                \\\"remote\\\": <remote email address user migrates from)>, \\n                \\\"server\\\": <remote server:remote port>,\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\"method\\\": imap4 | imap4s | pop3 | pop3s,\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\"skip\\\": [a list of folders on the remote server], \\n                \\\"translate\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<remote server folder: local server folder>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t...}, \\n            },\\n\\t\\t\\t\\t\\t\\t... \\n\\t\\t\\t]\\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 migration_add\"\n}\n[/block]\nThe following fields can be used in the **migration_add** method:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field name\",\n    \"h-1\": \"Obligation\",\n    \"h-2\": \"Definition/Value\",\n    \"0-0\": \"job\",\n    \"0-1\": \"Optional\",\n    \"0-2\": \"A job ID. This ID can be used in other migration requests. If an ID is not supplied in the request, it will be created and returned in the response.\",\n    \"1-0\": \"users\",\n    \"1-1\": \"Required\",\n    \"1-2\": \"Defines the source and destination of the email that you want to migrate. Allowed values are:\\n\\n  * **local** — Specifies the email account to which mail will be copied;; must be an existing account\\n   \\n  * **method** — Specifies the protocol that will be used to transfer email: imap4 or pop3, with or without SSL. Allowed values are **imap4, imap4s, pop3, pop3s.** \\n\\n **Note**: For pop3 migrations, only email in the remote address' INBOX will be transferred (for imap4 migrations, mail in all remote folders will be copied to local folders with the same name.\\n\\n  * **remote** — Specifies the email account from which mail will be copied.\\n  \\n  * **server** — Specifies the remote email server address including the port, in the format address:port.\\n  \\n  * **skip** — A list of folder names on the remote server to ignore. Sub folders should be separated with the IMAP server's path delimiter.\\n**Note:** This value is optional and is valid for imap migrations only.\\n\\n  * **translate** — A hash giving a mapping of remote folder names to local folder names. Messages on the remote server, in the remote folders will be copied to the local account to folders with the local name. Sub folders should be separated with the IMAP server's path delimiter. For local folders, the path separator is the dot character. For example, to specify the folder **/Sales/2009/June** use **\\\".Sales.2009.June\\\"**\\n  \\n **Note:** This value is optional, and is valid for imap migrations only.\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Response fields for migration_add\"\n}\n[/block]\nThe following fields may be returned when the migration_add 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\": \"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    \"1-2\": \"A number that represents the error.\",\n    \"2-0\": \"job\",\n    \"2-1\": \"Returned if **success = true**\",\n    \"2-2\": \"A job ID. This ID can be used in other migration requests.\",\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 migration_add\"\n}\n[/block]\nCreates a job to migrate account joseph.user:::at:::bigmail.com to local account joe_user@example.com, skipping the folders Trash and Spam, and moving messages from the remote folder Sent to the local folder Sent Items. \n\n**Request** \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"credentials\\\": {\\n\\t\\t\\\"user\\\": \\\"domain_admin@example.com\\\",\\n    \\\"password\\\": \\\"sw0rdf1sh\\\"\\n  },\\n\\t\\\"users\\\": [ {\\n\\t\\t\\\"local\\\": \\\"joe_user@example.com\\\", \\n    \\\"remote\\\": \\\"joseph_user@bigmail.com\\\", \\n    \\\"password\\\": \\\"abc123\\\",\\n\\t\\t\\\"server\\\": \\\"mail.bigmail.com:993\\\", \\n    \\\"method\\\": \\\"imap4s\\\",\\n    \\\"skip\\\": [\\n      \\\"Trash\\\",\\n\\t\\t\\t\\\"Spam\\\" \\n      ],\\n      \\\"translate\\\": {\\n        \\\"Sent\\\": \\\"Sent Items\\\"\\n\\t\\t\\t} \\n\\t\\t}\\n\\t] \\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  \\\"job\\\": \\\"1326229437638\\\"\\n}\",\n      \"language\": \"perl\",\n      \"name\": \"  \"\n    }\n  ]\n}\n[/block]","excerpt":"The **migration_add** job creates a bulk migration job that copies email from multiple remote accounts to multiple local accounts.","slug":"migration_add","type":"basic","title":"migration_add"}

migration_add

The **migration_add** job creates a bulk migration job that copies email from multiple remote accounts to multiple local accounts.

## Syntax [block:code] { "codes": [ { "code": "{\n\t\t<credentials object>, \n \"job\": <job id>, \n \"users\":\n\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"local\": <local email address user migrates to>, \n \"remote\": <remote email address user migrates from)>, \n \"server\": <remote server:remote port>,\n\t\t\t\t\t\t\t\t\"method\": imap4 | imap4s | pop3 | pop3s,\n\t\t\t\t\t\t\t\t\"skip\": [a list of folders on the remote server], \n \"translate\": {\n\t\t\t\t\t\t\t\t\t\t<remote server folder: local server folder>\n\t\t\t\t\t\t\t\t\t\t...}, \n },\n\t\t\t\t\t\t... \n\t\t\t]\n}", "language": "perl", "name": " " } ] } [/block] [block:api-header] { "type": "basic", "title": "Request fields for migration_add" } [/block] The following fields can be used in the **migration_add** method: [block:parameters] { "data": { "h-0": "Field name", "h-1": "Obligation", "h-2": "Definition/Value", "0-0": "job", "0-1": "Optional", "0-2": "A job ID. This ID can be used in other migration requests. If an ID is not supplied in the request, it will be created and returned in the response.", "1-0": "users", "1-1": "Required", "1-2": "Defines the source and destination of the email that you want to migrate. Allowed values are:\n\n * **local** — Specifies the email account to which mail will be copied;; must be an existing account\n \n * **method** — Specifies the protocol that will be used to transfer email: imap4 or pop3, with or without SSL. Allowed values are **imap4, imap4s, pop3, pop3s.** \n\n **Note**: For pop3 migrations, only email in the remote address' INBOX will be transferred (for imap4 migrations, mail in all remote folders will be copied to local folders with the same name.\n\n * **remote** — Specifies the email account from which mail will be copied.\n \n * **server** — Specifies the remote email server address including the port, in the format address:port.\n \n * **skip** — A list of folder names on the remote server to ignore. Sub folders should be separated with the IMAP server's path delimiter.\n**Note:** This value is optional and is valid for imap migrations only.\n\n * **translate** — A hash giving a mapping of remote folder names to local folder names. Messages on the remote server, in the remote folders will be copied to the local account to folders with the local name. Sub folders should be separated with the IMAP server's path delimiter. For local folders, the path separator is the dot character. For example, to specify the folder **/Sales/2009/June** use **\".Sales.2009.June\"**\n \n **Note:** This value is optional, and is valid for imap migrations only." }, "cols": 3, "rows": 2 } [/block] [block:api-header] { "type": "basic", "title": "Response fields for migration_add" } [/block] The following fields may be returned when the migration_add method is submitted: [block:parameters] { "data": { "h-0": "Field name", "h-1": "Obligation", "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**", "1-2": "A number that represents the error.", "2-0": "job", "2-1": "Returned if **success = true**", "2-2": "A job ID. This ID can be used in other migration requests.", "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 migration_add" } [/block] Creates a job to migrate account joseph.user@bigmail.com to local account joe_user@example.com, skipping the folders Trash and Spam, and moving messages from the remote folder Sent to the local folder Sent Items. **Request** [block:code] { "codes": [ { "code": "{\n \"credentials\": {\n\t\t\"user\": \"domain_admin@example.com\",\n \"password\": \"sw0rdf1sh\"\n },\n\t\"users\": [ {\n\t\t\"local\": \"joe_user@example.com\", \n \"remote\": \"joseph_user@bigmail.com\", \n \"password\": \"abc123\",\n\t\t\"server\": \"mail.bigmail.com:993\", \n \"method\": \"imap4s\",\n \"skip\": [\n \"Trash\",\n\t\t\t\"Spam\" \n ],\n \"translate\": {\n \"Sent\": \"Sent Items\"\n\t\t\t} \n\t\t}\n\t] \n}", "language": "perl", "name": " " } ] } [/block] **Response** [block:code] { "codes": [ { "code": "{\n \"success\": true\n \"job\": \"1326229437638\"\n}", "language": "perl", "name": " " } ] } [/block]