Ресурс forms: формы, созданные в кабинете. Только чтение. Поля: id, title, list_id (группа), body (HTML формы со стилями).
GET/mailer/forms.json
Список форм
Все формы аккаунта сразу, total: сколько их. С page и limit: страницами, до 1000 на странице. Поля по умолчанию: id, title. Фильтр: title. Сортировка: title, id. Форм нет: ответ 204.
curl https://v1.estismail.com/mailer/forms.json \
-H "X-Estis-Auth: ВАШ_КЛЮЧ"<?php
$ch = curl_init('https://v1.estismail.com/mailer/forms.json');
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ['X-Estis-Auth: ВАШ_КЛЮЧ'],
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $response;import requests
r = requests.get(
"https://v1.estismail.com/mailer/forms.json",
headers={"X-Estis-Auth": "ВАШ_КЛЮЧ"},
)
print(r.status_code, r.text)const res = await fetch("https://v1.estismail.com/mailer/forms.json", {
headers: { "X-Estis-Auth": "ВАШ_КЛЮЧ" },
});
console.log(res.status, await res.text());Ответ 200
{
"forms": [
{
"id": 4822,
"title": "Форма в подвале сайта"
}
],
"total": 1
}GET/mailer/forms/{id}.json
Одна форма
curl -G https://v1.estismail.com/mailer/forms/4822.json \
-H "X-Estis-Auth: ВАШ_КЛЮЧ" \
--data-urlencode 'fields=["id","title","list_id","body"]'<?php
$query = http_build_query([
'fields' => '["id","title","list_id","body"]',
]);
$ch = curl_init('https://v1.estismail.com/mailer/forms/4822.json' . '?' . $query);
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ['X-Estis-Auth: ВАШ_КЛЮЧ'],
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $response;import requests
r = requests.get(
"https://v1.estismail.com/mailer/forms/4822.json",
headers={"X-Estis-Auth": "ВАШ_КЛЮЧ"},
params={
"fields": '["id","title","list_id","body"]',
},
)
print(r.status_code, r.text)const params = new URLSearchParams({
fields: '["id","title","list_id","body"]',
});
const res = await fetch("https://v1.estismail.com/mailer/forms/4822.json?" + params, {
headers: { "X-Estis-Auth": "ВАШ_КЛЮЧ" },
});
console.log(res.status, await res.text());Ответ 200
{
"id": 4822,
"title": "Форма в подвале сайта",
"body": "<style type=\"text/css\">…</style><form …>…</form>",
"list_id": "12345"
}Вопросы по API: support@estismail.com