SpreadWebServcie.AddSubscriberByInfo Method

It adds a single subscriber into an existing subscription by his/her email as well as other Info. Such as First Name, Company, Job Title, etc.

public bool addSubscriberByInfo (

string loginEmail,

string password,

Subscriber subscriberArgs,

string subscription,

DoubleOptIn optInType

)

Public function addSubscriberByInfo( _

loginEmail As String, _

password As String, _

subscriberArgs As Subscriber, _

subscription As String, _

optInType As DoubleOptIn _

) As Boolean

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

The info of subscriber to be added.

subscription

String

The name of target subscription to be added.

optInType

DoubleOptIn

Double Opt-in option.

Return Value

When the HTTP status code is 200, it means the subscriber is added successfully.
true/false indicates whether the subscriber needs to confirm the subscription, see Double Opt-In

HTTP status code Retrun Message Status/Situation
200 true Add successfully, the subscriber needs to confirm subscription
200 false Add successfully, the subscriber does not need to confirm subscription
500 Spreader Email and Password not match! Please check if the parameters loginEmail and password are filled in incorrectly, and check the API Url (FAQ)
500 Subscription "xxxx" does not exist! The Subscription “xxxx” does not exist
500 Please provide a subscriber email. Parameter subscriberEmail is empty, please fill in this parameter In Parameter subscriberArgs, email or homePhone is null,please fill in at least one of them
500 Email address "123@123" is not valid! email address format error
500 Fail to add subscriber. Failed to add subscriber, please contact technical staff.
500 Email address is empty and phone "86xxx" is not valid! The email in the subscriberArgs parameter is empty, and the homePhone format is wrong

Example

string loginName = "spread@reasonables.com";

string loginPassword = "TEST0000-TEST-0000-TEST-0000TEST0000";

string customerEmail = "test@reasonables.com";

string targetSubscription = "NoClone VIP";

DoubleOptIn addOption = DoubleOptIn.Off;

bool confirmIsNeeded;

 

//Create a Subscriber object

Subscriber customer = new Subscriber();
customer.email =
"test@reasonables.com";
customer.firstName =
"Alan";
customer.lastName =
"Wo";
customer.company =
"Reasonable Software";

 

//Create a SpreadWebService object and use its method.

SpreadWebService MySpread = new SpreadWebService();

 

confirmIsNeeded = MySpread.addSubscriberByInfo (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 confirmIsNeeded As Boolean

 

'Create a subscriber object

Dim customer As New Subscriber

customer.email = "test@reasonables.com"

customer.firstName = "Alan"

customer.lastName = "Wo"

customer.company = "Reasonable Software"

 

'Create a SpreadWebService object and use its method.

Dim MySpread As New SpreadWebService

 

confirmIsNeeded = MySpread.addSubscriberByInfo(loginName, loginPassword, customer, _ targetSubscription, addOption)

/**
* @name     addSubscriberByInfo
* @function add single subscriber's 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			success message
*/
public function addSubscriberByInfo($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 -> addSubscriberByInfo( $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>
    <addSubscriberByInfo xmlns="http://service.reasonablespread.com/">
      <loginEmail>spread@reasonables.com</loginEmail>
      <password>TEST0000-TEST-0000-TEST-0000TEST0000</password>
      <subscriberArgs>
        <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>
      </subscriberArgs>
      <subscription>NoClone VIP</subscription>
      <optInType>Off</optInType>
    </addSubscriberByInfo>
  </soap12:Body>
</soap12:Envelope>