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>