获取邮件模板列表

Get templates list 获取邮件模板列表

Templates 接口允许通过API 的HTTP GET方式调取后台系统中的一系列现成模板(如页眉、页脚)。例如该功能可以在调用API发送Newsletter时使用.

请求数据格式

请求 URL 参数:
参数 类型 描述
apiKey string API Key, 验证时须出示. 必填.
type string 返回的模板类型。选填。如若未指明具体类型,将返回所有类型的模板.

模板类型的合法值有:

      • Header 页眉
      • Footer  页脚

示例:

https://api.esv2.com/v2/Api/Templates?apiKey=YOUR_API_KEY_HEREhttps://api.esv2.com/v2/Api/Templates?apiKey=YOUR_API_KEY_HERE&type=Footer

应答

应答数据元素:
元素/属性 类型 描述
Templates array[complex] Template元素组成的数组.

Template 子元素:

元素/属性 类型 描述
Id int 模板标识ID.
Type string 两种模板类型,选其一:

      • 页眉
      • 页脚
Name string 模板名称.

示例

请求:
GET https://api.esv2.com/v2/Api/Templates?apiKey=test_api_key1 HTTP/1.1

Accept-Encoding: gzip,deflate
Host: api.esv2.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
应答:
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNetMvc-Version: 5.1
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 05 Mar 2014 13:19:51 GMT
Content-Length: 345<ApiResponse
xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>

 <Data>
  <Templates>
   <Template>
    <Id>1</Id>
    <Type>Footer</Type>
    <Name>Default EN footer</Name>
   </Template>
   <Template>
    <Id>2</Id>
    <Type>Footer</Type>
    <Name>Default PL footer</Name>
   </Template>
   <Template>
    <Id>3</Id>
    <Type>Header</Type>
    <Name>My custom header</Name>
   </Template>
   <Template>
    <Id>4</Id>
    <Type>Header</Type>
    <Name>Some other header</Name>
   </Template>
  </Templates>
 </Data>
</ApiResponse>