获取Snippet片段

Get Snippets 获取Snippet片段

获取Snippet片段接口允许获取到在某特定且处于启用中的事务性邮件的全部Snippet片段.

 

请求数据格式

请求URL参数:
参数 类型 描述
ApiKey string API key用于验证身份. 必填.
Id int 启用中的事务性邮件ID. 要求作为(GET方法)请求URL地址的一部分使用. 见下例.

 

示例:
https://api.esv2.com/v2/Api/Snippets/234?apiKey=YOUR_API_KEY_HERE

 

应答

应答数据元素: 

元素/属性名称 类型 描述
Snippets array[complex] 片段数列集合.

Snippet子元素: 

元素/属性名称 类型 描述
Snippet string  已启用的事务性邮件内容中定义的Snippet片段名称.
注释 1. 在事务性邮件内容中有两种定义Snippet片段的办法:
    • 使用个性化标签 *[tr_snippetname]*
    • 使用智能内容控制 ${Snippet(‘snippetname’)}
注释 2. 将会搜索处于邮件内容中已定义好的Snippet片段, so it can take more application resources(没明白这句话…).
 

 

示例

请求:

GET 

https://api.esv2.com/v2/Api/Snippets/234?apiKey=test_api_key1 HTTP/1.1 
Accept-Encoding: gzip,deflate 
User-Agent: Jakarta Commons-HttpClient/3.1 
Host: api.esv2.com

 

OK 应答:

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Encoding: gzip
Vary: Accept-Encoding
Server: Microsoft-IIS/7.5
Set-Cookie: ASP.NET_SessionId=cu23cqm125fq1qih1kg4ux45; path=/; HttpOnly
X-AspNetMvc-Version: 1.0
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Mon, 22 Jan 2018 12:56:22 GMT
Content-Length: 349
<ApiResponse xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
<Data>
<Snippets>
<Snippet>SnippetName1</Snippet>
<Snippet>SnippetName2</Snippet>
<Snippet>SnippetName3</Snippet>
<Snippet>SnippetName4</Snippet>
</Snippets>
</Data>
</ApiResponse>

 

当事务性邮件中不包含任何Snippet片段的OK 应答:

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Encoding: gzip
Vary: Accept-Encoding
Server: Microsoft-IIS/7.5
Set-Cookie: ASP.NET_SessionId=cu23cqm125fq1qih1kg4ux45; path=/; HttpOnly
X-AspNetMvc-Version: 1.0
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Mon, 22 Jan 2018 12:56:22 GMT
Content-Length: 171
<ApiResponse xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
<Data>
<Snippets/>
</Data>
</ApiResponse>