Skip Navigation Links.
展开 最小化

Upload Zip Creative Example

下面的例子演示了 上傳一個電子郵件內容.如果campaignID是空值,創建一個新的郵件活動. 你可以從 這裡 下載電郵模板

參數

參數

類型

描述

loginEmail

String

Spread賬號的登錄郵箱.

loginPassword

String

Spread賬號的密碼或者 API Key .

fileStream

byte[]

上傳zip文件的文件流.

campaignId

Int

郵箱活動的ID

返回結果

True - 如果成功

HTTP狀態碼 返回信息 狀態/場景
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文件

例子


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>