Skip Navigation Links.
展开 最小化

Upload Zip Creative Example

The following example demonstrates upload a email content .if campaignID is nothing ,create a new campaign . You can download ZIP template from here

Parameters

Parameter

Type

Description

loginEmail

String

The login email of your Spread account.

loginPassword

String

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

fileStream

byte[]

The zip file stream.

campaignId

Int

The ID of the email campaign.

Return Value

True - if succeed

HTTP status code Retrun Message Status/Situation
200 true 成功
200 false 失败
500 Spreader Email and Password not match! 请检查参数loginEmailpassword以及请求的接口链接,是否填写错误(常见问题
500 Do not have permissions to implement the operation! 请检查参数campaignId,是否属于此账号
500 Cannot found the HTML file. 没有找到上传的HTML文件

Example


string loginName = "spread@reasonables.com";
string loginPassword = "TEST0000-TEST-0000-TEST-0000TEST0000";
int campaignId = 123456;

System.IO.FileStream zipFileStream = new System.IO.FileStream(@"D:\Uplode\output.zip",System.IO.FileMode.Open);
byte [] arrayByte = new byte [zipFileStream.Length];
zipFileStream.Read (arrayByte,0,arrayByte.Length);
zipFileStream.Close();

SpreadWS.SpreadWebService mySpread = new SpreadWS.SpreadWebService();
bool result = mySpread.UplodeZipFile(loginName, loginPassword, arrayByte, campaignId);

Dim loginName As String = "Spread@reasonables.com"

Dim loginPassword As String = "TEST0000-TEST-0000-TEST-0000TEST0000"

Dim campaignID As Integer = 123456

 

Dim zipFileStream As New System.IO.FileStream("D:\Uplode\output.zip", IO.FileMode.Open)

Dim arrayByte = New Byte(zipFileStream.Length-1) {}

zipFileStream.Read(arrayByte, 0, zipFileStream.Length)

zipFileStream.Close()

 

Dim MySpread As New SpreadAPI.SpreadWebService()

Dim result As Boolean = MySpread.UplodeZipFile(loginName, loginPassword, arrayByte, campaignID)


$file = "D:\Uplode\output.zip";
$arrayByte=file_get_contents($file);

$client = new SoapClient("http://service.respread.com/Service.asmx?WSDL");
$client->soap_defencoding = 'utf-8'; 
$client->decode_utf8 = false;  
$client->xml_encoding = 'utf-8';
 
$arrayPara =array('loginEmail'=>'spread@reasonables.com','loginPassword'=>'spread','fileStream'=>$arrayByte,'campaignId'=>'123456');
$result = $client->UplodeZipFile($arrayPara);
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>
    <UplodeZipFile xmlns="http://service.reasonablespread.com/">
        <loginEmail>Spread@reasonables.com</loginEmail>
        <loginPassword>TEST0000-TEST-0000-TEST-0000TEST0000</loginPassword>
        <fileStream>base64Binary</fileStream>
        <campaignId></campaignId>
    </UplodeZipFile>
    </soap12:Body>
</soap12:Envelope>