string
loginName
= "spread@reasonables.com";
string
loginPassword
= "TEST0000-TEST-0000-TEST-0000TEST0000";
string
customerEmail
= "tset@reasonables.com";
string
targetSubscription
= "NoClone
VIP";
DoubleOptIn addOption = DoubleOptIn.Off;
Dataset
errors;
//Create an
array of subscriber
Subscriber[] customer
= new
Subscriber[2];
//Create more
then one Subscriber objects
Subscriber customerA =
new Subscriber();
customerA.email =
"tset@reasonables.com";
customerA.firstName =
"Alan";
customerA.lastName =
"Wo";
customerA.company =
"Reasonable Software";
Subscriber customerB =
new Subscriber();
customerB.email =
"tset2@reasonables.com";
customerB.firstName =
"Circle";
customerB.lastName =
"Ching";
customerB.jobTitle =
"CEO";
//Put the Subscriber
objects into array
customer[0]
= customerA;
customer[1]
= customerB;
//Create a SpreadWebService
object and use its method.
SpreadWebService MySpread = new
SpreadWebService();
errors = MySpread.addSubscribersByInfo
(loginName, loginPassword, customer, targetSubscription, addOption);
Dim
loginName
As String =
"spread@reasonables.com"
Dim
loginPassword
As String =
"TEST0000-TEST-0000-TEST-0000TEST0000"
Dim
targetSubscription As String =
"NoClone VIP"
Dim addOption
As
DoubleOptIn
= DoubleOptIn.Off
Dim errors
As Dataset
'Create an array
of subscriber
Dim customer()
As Subscriber
= New Subscriber(1) {}
'Create more
then one Subscriber objects
Dim customerA
As New Subscriber
customerA.email = "tset@reasonables.com"
customerA.firstName = "Alan"
customerA.lastName
=
"Wo"
customerA.company = "Reasonable
Software"
Dim customerB
As New Subscriber
customerB.email = "tset2@reasonables.com"
customerB.firstName = "Circle"
customerB.lastName
=
"Ching"
customerB.jobTitle = "CEO"
'Put the Subscriber
objects into array
customer(0)
= customerA
customer(1)
= customerB
'Create a SpreadWebService
object and use its method.
Dim
MySpread
As New SpreadWebService
errors = MySpread.addSubscribersByInfo(loginName,
loginPassword, customer, _ targetSubscription, addOption)
/**
* @name addSubscribersByInfo
* @function add multiple subscribers' email address
* @param
* optInType 'Off'
* data receiver data
* (array import)
* $data = array(
* 'email' => 'spread@reasonables.com', (required)
* 'firstName' => 'spread', (optional)
* 'lastName' => 'siqi', (optional)
* 'date1' => date( 'c' ) (optional, current time)
* 'date2' => date( 'c' ) (optional, current time)
* ...... => ......
* );
* @return
* errorMsg failed message
* Msg
*/
public function addSubscribersByInfo($loginEmail,$password,$data,$listName,$optInType){
$addInArr = array(
'loginEmail' => $loginEmail,
'password' => $password,
'subscriberArgs' => $data,
'subscription' => $listName,
'optInType' => $optInType
);
$Client = new SoapClient("http://service.rspread.com/Service.asmx?WSDL");
$errorMsg = $Client -> addSubscribersByInfo( $addInArr );
return $errorMsg;
}
POST {{YOUR_API_URL}}/service.asmx
Content-Type: application/soap+xml; charset=utf-8
Content-Length: {{length}}
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<addSubscribersByInfo xmlns="http://service.reasonablespread.com/">
<loginEmail>spread@reasonables.com</loginEmail>
<password>TEST0000-TEST-0000-TEST-0000TEST0000</password>
<subscriberArgs>
<Subscriber>
<email>test@reasonables.com</email>
<firstName>Alan</firstName>
<lastName>Wo</lastName>
<company>Reasonable Software</company>
<date1>2023-02-06T12:11:21</date1>
<date2>2023-02-06T12:11:21</date2>
<customField1>string</customField1>
</Subscriber>
<Subscriber>
<email>test2@reasonables.com</email>
<firstName>Circle</firstName>
<lastName>Ching</lastName>
<jobTitle>CEO</jobTitle>
<customField1>string</customField1>
</Subscriber>
</subscriberArgs>
<subscription>NoClone VIP</subscription>
<optInType>Off</optInType>
</addSubscribersByInfo>
</soap12:Body>
</soap12:Envelope>