Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages

listTemplates method

This method is used to get the list of templates created both through the UniSender personal account and through the API. The method works like getTemplates, the only difference of listTemplates is that the body parameter is not returned. To get the body, use the getTemplate method.

To display the list of templates, you need to specify the time frame for the search and your API key. Additionally, you can specify the number of templates to display in one request, the position from which the list of templates will be displayed for this request, and the format for displaying returned data (json / html).

Principle of use

Syntax and URL to call the method
listTemplates (datetime date_from, datetime date_to, string format, int limit, int offset)
https://api.unisender.com/en/api/listTemplates?format=json&api_key=KEY
Аргументы
api_key * API access key.
type The template type obtains the following values: system|user;

system — system templates (their display does not depend on the template creation date and time, i.e. the date_from and date_to parameters);

user — user templates (default value).

date_from Template creation date and time, from which templates are to be displayed, in the «YYYY-MM-DD hh:mm:ss» format, time zone UTC.
date_to Template creation date and time, until which templates are to be displayed, in the «YYYY-MM-DD hh:mm:ss» format, time zone UTC.
format The display format obtains values of html | json, json is set by default (the html format is intended only for visual viewing of the result, the parser will not work in this format).
limit Number of records in the response to one request must be an integer in the range from 1 to 100, 50 records are set by default.
offset The parameter indicates from which position the selection is to be started. The value must be 0 or more (the position of the first record starts from 0), 0 is set by default.
Return value
JSON array, each array element is an object with the following fields. Description of fields is under the example.
Example of the return value:

{
 "result": [
 {
 "id": "943434",
 "sub_user_login": "",
 "title": "test",
 "description": "",
 "lang_code": "ru",
 "subject": "test",
 "attachments": "",
 "screenshot_url": "https://api.unisender.com/ru/v5/preview/template/
   57szc6e88kxw6osb7cuj5k11wwe",
 "created": "2015-10-06 14:54:23",
 "message_format": "block",
 "type": "user",
 "fullsize_screenshot_url":"" 
 },
 {},
 {}
 ]
}

Where:

id — identifier of the template in the system;
sub_user_login — either the login of the sub-user who created the template or NULL if the letter was created by the master user;
title — name of the template in the system;
description — text description of the template;
lang_code — two-letter language code to be automatically added to the letter with the unsubscribe form (for example, ‘ru’, ‘en’);
subject — template subject;
attachments — attachments;
screenshot_url — link to the template screenshot;
created — template creation date and time, UTC;
message_format — returns the manner of creating a template: “block” — block editor, “raw_html” — html editor;
type — template type (system/user);
fullsize_screenshot_url — returns the link to the full-size image of the system template. The parameter will be returned if type = system.

Формат ошибок:

{
   {"error":"VK151214-01 [ 'date_from' value is not a valid datetime "2015-12-14 12:5x"]"} 
   {"error":"VK151214-01 [ 'date_to' value is not a valid datetime "2015-12-14 22:0x"]"} 
   {"error":"VK151214-01 [ 'limit' value should be a valid number]"} 
   {"error":"VK151214-01 [ 'offset' value should be greater than or equal to 0]"}
}
Оцените, на сколько вам показалась полезной статья «listTemplates method»
(0)