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>