This method creates and automatically starts an import process for the contacts listed in the xmlDoc parameter. You can use this method instead of calling a sequence of NewImportProcess and StartProcess methods. StartImportProcesses can also be used to update fields of an existing contact. Please note that, while updating, empty parameters are handled as "do not update this field", not as "overwrite with an empty value".
...
Code Block |
---|
language | html/xml |
---|
title | Lists and groups (example) |
---|
collapselinenumbers | true |
---|
|
<ws:listsIDs>1</ws:listsIDs>
<ws:listsGUIDs>66af9900-7dd7-4cca-9125-beadaf3a3a59;0e591119-xxxx-yyyy-zzzz-6ac75384b564</ws:listsGUIDs>
<ws:groupsIDs></ws:groupsIDs> |
...
Code Block |
---|
language | html/xml |
---|
title | Lists and groups (example) |
---|
collapse | linenumbers | true |
---|
|
<ws:listsIDs>1</ws:listsIDs>
<ws:listsGUIDs>66af9900-7dd7-4cca-9125-beadaf3a3a59;0e591119-xxxx-yyyy-zzzz-6ac75384b564</ws:listsGUIDs>
<ws:groupsIDs>22</ws:groupsIDs> |
...
Code Block |
---|
language | html/xml |
---|
title | Lists and groups (example) |
---|
collapse | linenumbers | true |
---|
|
<ws:listsGUIDs>66af9900-7dd7-4cca-9125-beadaf3a3a59;0e591119-xxxx-yyyy-zzzz-6ac75384b564</ws:listsGUIDs>
<ws:groupsIDs>22,23</ws:groupsIDs> |
...
Code Block |
---|
language | html/xml |
---|
title | Lists and groups (example) |
---|
collapselinenumbers | true |
---|
|
<ws:listsIDs>1;2</ws:listsIDs>
<ws:listsGUIDs>66af9900-7dd7-4cca-9125-beadaf3a3a59;0e591119-xxxx-yyyy-zzzz-6ac75384b564</ws:listsGUIDs>
<ws:groupsIDs>;</ws:groupsIDs> |
Add recipients to multiple lists (one group per list)
In this example, we specify both the listsIDs
and the listsGUIDs
parameters. Each of the parameters must have the same number of elements (separated by semi-colons). In this case, we are specifying group 22 for list 1, and group 13 for list 2.
Code Block |
---|
language | html/xml |
---|
title | Lists and groups (example) |
---|
collapselinenumbers | true |
---|
|
<ws:listsIDs>1;2</ws:listsIDs>
<ws:listsGUIDs>66af9900-7dd7-4cca-9125-beadaf3a3a59;0e591119-xxxx-yyyy-zzzz-6ac75384b564</ws:listsGUIDs>
<ws:groupsIDs>22;13</ws:groupsIDs> |
...
Code Block |
---|
language | html/xml |
---|
title | Lists and groups (example) |
---|
collapselinenumbers | true |
---|
|
<ws:listsIDs>1;2</ws:listsIDs>
<ws:listsGUIDs>66af9900-7dd7-4cca-9125-beadaf3a3a59;0e591119-xxxx-yyyy-zzzz-6ac75384b564</ws:listsGUIDs>
<ws:groupsIDs>22,23;13</ws:groupsIDs> |
...
The XML structure for each recipient needs to be consistent for all subscribers, and include empty tags for required values that are empty. When specifying the phone number for a recipient, the structure of your XML must match the mobileInputType
parameter, where either the entire phone number is represented in a single attribute, or the prefix and number are represented in separate attributes.
For example, if the mobileInputType
parameter is set to 1
,use the following XML structure:
Code Block |
---|
|
<!--Option 1: number and prefix in a single field (use mobileInputType=1)-->
<subscriber email="user@myprovider.com" Prefix="" Number="+0018889624587" Name=""> |
If the mobileInputType
parameter is set to 2
, use the following XML structure:
Code Block |
---|
|
<!--Option 2: number and prefix in separate fields (use mobileInputType=2)-->
<subscriber email="user@myprovider.com" Prefix="+001" Number="8889624587" Name=""> |
An example XML subscriber is represented below (note the empty tags for all data fields below 11)
Code Block |
---|
language | html/xml | title | Example of xmlDoc |
---|
firstline | 1 |
---|
linenumbers | true |
---|
collapse | true |
---|
|
<subscribers>
<subscriber email="mike@example.com" Prefix="" Number="" Name="">
<campo1>Mike</campo1>
<campo2>Brown</campo2>
<campo3>Example Company</campo3>
<campo4>Los Angeles</campo4>
<campo5> </campo5>
<campo6>90125</campo6>
<campo7>CA</campo7>
<campo8>US</campo8>
<campo9>555 Some Street</campo9>
<campo10></campo10>
<campo11>555-123-1234</campo11>
</subscriber>
<!-- repeat for each recipient to import -->
</subscribers> |
You can use 0
and 1
in place of true
and false for boolean parameter values.
...
Code Block |
---|
language | html/xml | title | SOAP request |
---|
linenumbers | true |
---|
collapse | true |
---|
|
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.mailupnet.it/">
<soapenv:Header>
<ws:Authentication>
<ws:User>user</ws:User>
<ws:Password>password</ws:Password><ws:encType>UTF-8</ws:encType>
</ws:Authentication>
</soapenv:Header>
<soapenv:Body>
<ws:StartImportProcesses>
<ws:listsIDs>1</ws:listsIDs>
<ws:listsGUIDs>66af9900-xxxx-yyyy-zzzz-beadaf3a3a59</ws:listsGUIDs>
<ws:xmlDoc>
<subscribers><subscriber email="mike@example.com" Prefix="" Number="" Name=""><campo1>Mike</campo1><campo2>Brown</campo2><campo3>Example Company</campo3><campo4>Los Angeles</campo4><campo5></campo5><campo6>90125</campo6><campo7>CA</campo7><campo8>US</campo8><campo9>711 Some Street</campo9><campo10></campo10><campo11>555-123-1234</campo11></subscriber></subscribers>
</ws:xmlDoc>
<ws:groupsIDs></ws:groupsIDs>
<ws:importType>3</ws:importType>
<ws:mobileInputType>1</ws:mobileInputType>
<ws:ConfirmEmail>false</ws:ConfirmEmail>
<ws:forceOptIn>true</ws:forceOptIn>
<ws:asPending>false</ws:asPending>
<ws:asOptOut>false</ws:asOptOut>
<ws:replaceGroups>false</ws:replaceGroups>
</ws:StartImportProcesses>
</soapenv:Body>
</soapenv:Envelope> |
...
Code Block |
---|
language | html/xml |
---|
title | SOAP response |
---|
linenumbers | true | collapse | true |
---|
|
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<StartImportProcessesResponse xmlns="http://ws.mailupnet.it/">
<StartImportProcessesResult><![CDATA[
<?xml version="1.0" encoding="windows-1252" ?>
<mailupMessage>
<mailupBody>
<ReturnCode>0</ReturnCode>
<processes>
<process>
<processID>69</processID>
<listID>1</listID>
<ReturnCode>0</ReturnCode>
</process>
<process>
<processID>70</processID>
<listID>2</listID>
<ReturnCode>0</ReturnCode>
</process>
</processes>
</mailupBody>
</mailupMessage>]]>
</StartImportProcessesResult>
</StartImportProcessesResponse>
</soap:Body>
</soap:Envelope> |
...
Ruby
Code Block |
---|
language | ruby |
---|
linenumbers | true |
---|
|
# Refer to https://mailup.atlassian.net/wiki/display/mailupapi/MailUp+RubyGem for gem information.
require 'mail up'
m = MailUp::Import.new('username', 'password', 'console_url')
m.start_import_processes(
listsIDs: "1;2;3",
listsGUIDs: "abc123;def456;ghi789",
xmlDoc: xml_data_string,
groupsIDs: '',
importType: 3,
mobileInputType: 1
)
# => <?xml version=\"1.0\" encoding=\"windows-1252\" ?><mailupMessage><mailupBody><ReturnCode>0</ReturnCode><processes>...</processes></mailupBody></mailupMessage> |
...
Code Block |
---|
language | php |
---|
linenumbers | true | collapse | true |
---|
|
<?php
class MailUpWsImport {
protected $ns = "http://ws.mailupnet.it/";
//replace <console host name> with the host name of your console
protected $WSDLUrl = "http://<console host name>/services/WSMailUpImport.asmx?WSDL";
protected $headers = array("User" => "user", "Password" => "password");
protected $rCode;
private $soapClient;
private $xmlResponse;
protected $domResult;
function __construct() {
$this->header = new SOAPHeader($this->ns, "Authentication", $this->headers);
$this->soapClient = new SoapClient($this->WSDLUrl,array("trace" => 1,"exceptions" => 0));
$this->soapClient->__setSoapHeaders($this->header);
}
function __destruct() {
unset($this->soapClient);
}
//...
public function startImportProcesses($processData) {
try {
echo $processData."<br/><br/>";
$this->soapClient->StartImportProcesses($processData);
} catch (SoapFault $soapFault) {
var_dump($soapFault);
}
}
//...
}
$WsImport = new MailUpWsImport();
$xmlData = <<<EOT
<subscribers><subscriber email="test@example.com" Prefix="+39" Number="3351234567" Name="Test">
<campo1>Luigi</campo1><campo2>Rossi</campo2><campo3>Rossi consulting</campo3><campo4>Parma2</campo4><campo5>PR</campo5>
<campo6>43102</campo6><campo7></campo7><campo8>ITA</campo8><campo9>Via Garibaldi, 1</campo9><campo10>0521123456</campo10>
<campo11>0521123457</campo11></subscriber></subscribers>
EOT;
$startImportProcessData = array(
"listsIDs" => "4",
"listsGUIDs" => "3c5cb08c-f0b5-4bd6-9c2a-b687ecdac8b4",
"xmlDoc" => $xmlData,
"groupsIDs" => "22",
"importType" => "3",
"mobileInputType" => "2",
"asPending" => '0',
"ConfirmEmail" => "0",
"asOptOut" => "0",
"forceOptIn" => "0",
"replaceGroups" => "0"
);
$WsImport->startImportProcesses($startImportProcessData);
?> |
...