Skip Navigation Links.
展开 最小化

SpreadWebServcie.AddSubscribersByInfo Method

It adds more then one subscribers into an existing subscription by his/her email as well as other Info. Such as First Name, Company, Job Title, etc.

public Dataset addSubscribersByInfo (

string loginEmail,

string password,

Subscriber[] subscriberArgs,

string subscription,

DoubleOptIn optInType

)

Public function addSubscribersByInfo( _

loginEmail As String, _

password As String, _

subscriberArgs() As Subscriber, _

subscription As String, _

optInType As DoubleOptIn _

) As Dataset

No sample for PHP.
No sample.

Parameters

Parameter

Type

Description

loginEmail

String

The login email of your Spread account.

password

String

The password of your Spread account or API Key which you can retrieve from your Spread account (My account=> Settings).

subscriberArgs

Subscriber[]

Array of info of subscribers to be added.

Note: 1. If the length of subscriberArgs is less than 100, it will return the result of uploading.

subscription

String

The name of target subscription to be added.

optInType

DoubleOptIn

Double Opt-in option.

Return Value

Dataset There will be including a datatble. the datatable will be like the following tables.

1. The length of subscriberArgs is less than 100. The count of rows will equal the length of subscriberArgs. There will be the result of all emails. The Error column will show the successful message and failed message.

Email

Error

tset@reasonables.com

success

reasonable@reasonable

Email address "reasonable@reasonable" is not valid!

Please provide a subscriber email.

2. The length of subscriberArgs is more than 100. There will be one row for message including the requestId.

Email

Error

Size more than 100, turn to file upload, the RequestID is 0123456789

Example

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>