NewImportProcess prepares an import process but it does not start it. You can use StartProcess method to make it start by specifying idProcess value that is returned by NewImportProcess.
Please note that you cannot activate more than one import process at the same time, however you can prepare many import processes with NewImportProcess and then call StartImportProcesses method that starts all of them in a sequential manner.
Method parameters
NewImportProcess(int idList, int listGUID, idGroup, string xmlDoc, string idGroups, int importType,
int mobileInputType, bool asPending, bool ConfirmEmail, bool asOptOut, bool forceOptIn,
bool replaceGroups, int idConfirmNL)
...
If the import process is created successfully, then an "idProcess" value identifying it is returned; if not, a ReturnCode is returned.
Please refer to WSMailUpImport.StartImportProcesses for details about allowed data format of each parameter. In particular, please pay attention to the constraints that are described "XML structure" in section for xmlDoc parameter.
Sample ReturnCode
Code Block |
---|
language | html/xml |
---|
linenumbers | true |
---|
|
<mailupMessage>
<mailupBody>
<ReturnCode>17</ReturnCode>
</mailupBody>
</mailupMessage> |
Error codes
Error code | Description |
---|
-400 | unrecognized error |
-401 | xmlDoc is empty |
-402 | convert xml to csv failed |
-403 | create new import process failed |
-410 | cannot create confirmation email |
XML feed
The XML structure for importing subscribers is shown below:
Code Block |
---|
language | html/xml |
---|
linenumbers | true |
---|
|
<subscribers>
<subscriber email="user@myprovider.com" Prefix="+001" Number="8889624587" Name="">
<campo1>first name</campo1>
<campo2>last name</campo2>
<campo3>Nweb SRL</campo3>
</subscriber>
</subscribers> |
Phone numbers can be specified in two ways:
Code Block |
---|
language | html/xml |
---|
linenumbers | true |
---|
|
<subscriber email="user@myprovider.com" Prefix="" Number="+0018889624587" Name=""> |
Code Block |
---|
language | html/xml |
---|
linenumbers | true |
---|
|
<subscriber email="user@myprovider.com" Prefix="+001" Number="8889624587" Name=""> |
Ruby Example
Code Block |
---|
|
# Refer to https://mailup.atlassian.net/wiki/display/mailupapi/MailUp+RubyGem for gem information.
require 'mailup'
m = MailUp::Import.new('username', 'password', 'console_url')
m.new_import_process(:listID => 123456, :listGuid => 123456, :xmlDoc => "XML_STRING", ...)
# => <?xml version=\"1.0\" encoding=\"windows-1252\" ?><mailupMessage><mailupBody><ReturnCode>17</ReturnCode></mailupBody></mailupMessage> |