Get snippets
Snippets collection allows retrieving all snippets defined in a specified active transactional message.
Request data format
Request URL parameters:
Element/attribute | Type | Notes |
---|---|---|
ApiKey | string | Your API key, required for authentication. Required. |
Id | int | Active Transactional ID. Required as a part of address (GET parameter). See example below. |
Example:
https://api.esv2.com/v2/Api/Snippets/234?apiKey=YOUR_API_KEY_HERE
Response
Response Data element:
Element/attribute | Type | Notes |
---|---|---|
Snippets | array[complex] | Array of Snippet elements. |
Snippet element children:
Element/attribute | Type | Notes |
---|---|---|
Snippet | string | Snippet name defined in the active transactional message content. |
Note 1. In transactional message content there are two ways to define snippet:
- using personalization tag *[tr_snippetname]*
- using DC function ${Snippet(’snippetname’)}
Note 2. Searching for snippet definitions will be in email content, so it can take more application resources.
Examples
Request:
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 response:
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>
OK Response when the specified transactional doesn’t have any snippets:
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>