Skip Navigation Links.
展开 最小化

SpreadWebServcie.AddSubscribersByInfo Method

添加多個訂閱者到一個現有的聯絡人名單,由他/她的電子郵件以及其他信息。如姓名、公司、職位等.

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.

參數

參數

類型

描述

loginEmail

String

Spread賬號登錄郵箱.

password

String

Spread賬號的密碼或者 API Key.

subscriberArgs

Subscriber[]

被添加訂閱者信息的數組.

註意 1.subscriberArgs的數量小於100的時候,程序會直接上傳並返回結果。2.subscriberArgs的數量大於100的時候,程序會提交批量上傳任務,傳回含有該任務ID的信息;完成批量上傳后,會有郵件通知。

subscription

String

添加到聯絡人名單的名稱.

optInType

DoubleOptIn

Double Opt-in option.

返回結果

Dataset 會包含一個Datatable,該Datatable格式會像下列表格。

1. subscriberArgs的數量小於100的時候。 subscriberArgs會和表格行數相同。表格會展示所有郵箱的上傳結果。"Error"列會展示成功或者失敗的信息。

Email

Error

tset@reasonables.com

success

reasonable@reasonable

Email address "reasonable@reasonable" is not valid!

Please provide a subscriber email.

2.subscriberArgs的數量大於100的時候。表格只有一行,顯示包含RequestID的信息。

Email

Error

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

例子

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>