Mailings

journal

request
GET /api/v2/mailings?sendMethod=SMS HTTP/1.1
Table 255. request description
Parameter Description

sendMethod

EMAIL | SMS

topic

mailing topic (for email only)

content

mailing content

startOn

start on for creation date

finishOn

finish on for creation date

pageable

Pageable description

response
HTTP/1.1 200 OK

{
  "content" : [ {
    "number" : 10000000002,
    "createdOn" : "2023-01-02",
    "topic" : null,
    "content" : "Тестовая рассылка #2",
    "totalNumberOfMessages" : 2,
    "numberOfSentMessages" : 0,
    "numberOfNotSentMessages" : 2,
    "cost" : 0.0
  }, {
    "number" : 10000000001,
    "createdOn" : "2023-01-01",
    "topic" : null,
    "content" : "Тестовая рассылка",
    "totalNumberOfMessages" : 3,
    "numberOfSentMessages" : 2,
    "numberOfNotSentMessages" : 1,
    "cost" : 4.0
  } ],
  "pageable" : {
    "pageNumber" : 0,
    "pageSize" : 10,
    "sort" : {
      "empty" : false,
      "sorted" : true,
      "unsorted" : false
    },
    "offset" : 0,
    "paged" : true,
    "unpaged" : false
  },
  "pageStatistics" : {
    "count" : 2,
    "cost" : 4.0
  },
  "totalStatistics" : {
    "count" : 2,
    "cost" : 4.0
  },
  "last" : true,
  "totalElements" : 2,
  "totalPages" : 1,
  "first" : true,
  "size" : 10,
  "number" : 0,
  "sort" : {
    "empty" : false,
    "sorted" : true,
    "unsorted" : false
  },
  "numberOfElements" : 2,
  "empty" : false
}
Table 256. response description
Path Type Description

content[].number

Number

mailing number

content[].createdOn

String

mailing created date

content[].topic

String

mailing topic

content[].content

String

mailing content

content[].totalCountOfMessages

Number

total number of messages

content[].numberOfSentMessages

Number

number of messages sent to the client

content[].numberOfNotSentMessages

Number

number of messages not sent to the client

content[].cost

Number

mailing cost

pageStatistics.count

Number

number of mailings for the selected period on the page

pageStatistics.cost

Number

mailings cost for the selected period on the page

totalStatistics.count

Number

total number of mailings for the selected period

totalStatistics.cost

Number

total mailings cost for the selected period

get

request
GET /api/v2/mailings/10000000001 HTTP/1.1
Table 257. /api/v2/mailings/{id}
Parameter Description

id

mailing id

response
HTTP/1.1 200 OK

{
  "sendMethod" : "SMS",
  "type" : "GENERAL",
  "number" : 10000000001,
  "topic" : null,
  "content" : "Тестовая рассылка",
  "createdOn" : "2023-01-01",
  "sentAt" : "11:00:00",
  "managerFamilyName" : "Иванов",
  "managerFirstName" : "Иван",
  "managerPatronymicName" : null,
  "sentCount" : 2,
  "waitCount" : 1,
  "notSentCount" : 0,
  "totalCount" : 3,
  "selectedFilterName" : null,
  "autoNotificationWorkPeriod" : null,
  "autoNotification" : false,
  "cities" : [ "Москва", "Санкт-Петербург" ],
  "shopNames" : [ "Первый магазин", "Второй магазин" ],
  "manualFilter" : {
    "familyName" : "Иванов",
    "gender" : true,
    "ageFrom" : 18,
    "ageTo" : 30,
    "birthdayFrom" : "2023-01-01",
    "birthdayTo" : "2023-07-01",
    "auto" : true,
    "computer" : true,
    "phoneAccepted" : false,
    "mailAccepted" : false,
    "hasOrders" : true,
    "hasClientCard" : false,
    "smsAccepted" : true,
    "emailAccepted" : true,
    "lastVisitFrom" : "2023-08-01",
    "lastVisitTo" : "2023-08-02",
    "cardSumFrom" : 10.0,
    "cardSumTo" : 20.0,
    "sumFrom" : 500.0,
    "sumTo" : 1000.0,
    "goodType" : "ACCESSORY",
    "orderType" : "GLASSES"
  }
}
Table 258. response description
Path Type Description

sendMethod

String

EMAIL | SMS

type

String

GENERAL | AUTO_NOTIFICATION | REMINDER

number

Number

mailing number

topic

String

mailing topic

content

String

mailing content

createdOn

String

mailing created date

sentAt

String

mailing sent time

managerFullName

String

manager full name

sentCount

Number

sent count

waitCount

Number

wait count

notSentCount

Number

not sent count

totalCount

Number

total count

manualFilter

Object

manualFilter

manualFilter.familyName

String

family name

manualFilter.gender

Boolean

gender

manualFilter.ageFrom

Number

age from

manualFilter.birthdayFrom

String

birthday from

manualFilter.birthdayTo

String

birthday to

manualFilter.auto

Boolean

auto

manualFilter.computer

Boolean

computer

manualFilter.phoneAccepted

Boolean

phoneAccepted

manualFilter.mailAccepted

Boolean

mail accepted

manualFilter.hasOrders

Boolean

has orders

manualFilter.hasClientCard

Boolean

has client card

manualFilter.smsAccepted

Boolean

sms accepted

manualFilter.emailAccepted

Boolean

email accepted

manualFilter.lastVisitFrom

String

last visit from

manualFilter.lastVisitTo

String

last visit to

manualFilter.cardSumFrom

Number

card sum from

manualFilter.cardSumTo

Number

card sum to

manualFilter.sumFrom

Number

sum from

manualFilter.sumTo

Number

sum to

manualFilter.goodType

String

good type

manualFilter.orderType

String

order type

cities

Array

cities

shopNames

Array

shop names

selectedFilterName

String

selected filter name

autoNotification

Boolean

is auto notification mailing

autoNotificationWorkPeriod

String

auto notification work period

patterns

request
GET /api/v2/mailings/patterns HTTP/1.1
response
HTTP/1.1 200 OK

[ {
  "id" : "FAMILY_NAME_RU",
  "pattern" : ":Ф:",
  "precalculatedLength" : 9
}, {
  "id" : "FIRST_NAME_RU",
  "pattern" : ":И:",
  "precalculatedLength" : 9
}, {
  "id" : "PATRONYMIC_NAME_RU",
  "pattern" : ":О:",
  "precalculatedLength" : 9
}, {
  "id" : "DEAR_RU",
  "pattern" : ":Уваж:",
  "precalculatedLength" : 9
}, {
  "id" : "BONUSES_BALANCE_RU",
  "pattern" : ":БалансБонусов:",
  "precalculatedLength" : 5
}, {
  "id" : "BONUSES_ACCUMULATED_RU",
  "pattern" : ":НачисленоБонусов:",
  "precalculatedLength" : 4
}, {
  "id" : "BONUSES_BURN_RU",
  "pattern" : ":СгораетБонусов:",
  "precalculatedLength" : 4
}, {
  "id" : "BONUSES_BURN_ON_RU",
  "pattern" : ":ДатаСгорания:",
  "precalculatedLength" : 10
}, {
  "id" : "CONTACT_LENS_DISCOUNT_END_ON_RU",
  "pattern" : ":АкцияМКЛ:",
  "precalculatedLength" : 10
}, {
  "id" : "FAMILY_NAME_EN",
  "pattern" : ":Surname:",
  "precalculatedLength" : 9
}, {
  "id" : "FIRST_NAME_EN",
  "pattern" : ":FirstName:",
  "precalculatedLength" : 9
}, {
  "id" : "DEAR_EN",
  "pattern" : ":Dear:",
  "precalculatedLength" : 9
}, {
  "id" : "BONUSES_BALANCE_EN",
  "pattern" : ":BonusBalance:",
  "precalculatedLength" : 5
}, {
  "id" : "BONUSES_ACCUMULATED_EN",
  "pattern" : ":AccruedBonuses:",
  "precalculatedLength" : 4
}, {
  "id" : "BONUSES_BURN_EN",
  "pattern" : ":BonusesBurn:",
  "precalculatedLength" : 4
}, {
  "id" : "BONUSES_BURN_ON_EN",
  "pattern" : ":BurningDate:",
  "precalculatedLength" : 10
}, {
  "id" : "CONTACT_LENS_DISCOUNT_END_ON_EN",
  "pattern" : ":CLOffer:",
  "precalculatedLength" : 10
} ]

failed messages

request
GET /api/v2/mailings/10000000002/failed-messages HTTP/1.1
Table 259. /api/v2/mailings/{id}/failed-messages
Parameter Description

id

mailing id

Parameter Description

status

mailing status

clientPhoneNumber

client phone number

clientFullName

client full name

response
HTTP/1.1 200 OK

{
  "content" : [ {
    "clientFamilyName" : "Bezos",
    "clientFirstName" : "Jeff",
    "clientPatronymicName" : "Americanson",
    "clientPhoneNumber" : "+1321321321",
    "status" : "SEND_ERROR"
  }, {
    "clientFamilyName" : "Пууманн",
    "clientFirstName" : "Анна",
    "clientPatronymicName" : "-",
    "clientPhoneNumber" : "+79052380921",
    "status" : "NO_PERMISSION"
  } ],
  "pageable" : {
    "pageNumber" : 0,
    "pageSize" : 10,
    "sort" : {
      "empty" : true,
      "sorted" : false,
      "unsorted" : true
    },
    "offset" : 0,
    "paged" : true,
    "unpaged" : false
  },
  "last" : true,
  "totalElements" : 2,
  "totalPages" : 1,
  "first" : true,
  "size" : 10,
  "number" : 0,
  "sort" : {
    "empty" : true,
    "sorted" : false,
    "unsorted" : true
  },
  "numberOfElements" : 2,
  "empty" : false
}
Table 260. response description
Path Type Description

content[].clientFamilyName

String

clientFamilyName

content[].clientFirstName

String

clientFirstName

content[].clientPatronymicName

String

clientPatronymicName

content[].clientPhoneNumber

String

clientPhoneNumber

content[].status

String

status

resend failed messages info

request
GET /api/v2/mailings/10000000002/failed-messages/resend-info HTTP/1.1
Table 261. /api/v2/mailings/{id}/failed-messages/resend-info
Parameter Description

id

mailing id

response
HTTP/1.1 200 OK

{
  "balance" : 250003.15,
  "cost" : 6.3
}

resend failed messages

request
PUT /api/v2/mailings/10000000002/failed-messages HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Table 262. /api/v2/mailings/{id}/failed-messages
Parameter Description

id

mailing id

response
HTTP/1.1 200 OK
Возможные ошибки:
  • 400 - в рассылке нет зафейленных сообщений

  • 403 - недостаточно средств для отправки смс рассылки

  • 404 - рассылки не существует

statuses

request
GET /api/v2/mailings/statuses HTTP/1.1
Table 263. request description
Parameter Description

statusType

null|SUCCESSFULLY_SENT|WAITING_TO_SEND|FAILED_TO_SEND

response
HTTP/1.1 200 OK

[ "STOPPED", "NON_SUFFICIENT_FUNDS", "QUEUE", "SEND_ERROR", "SEND_OK", "SEND_ATTEMPT", "NO_PERMISSION" ]
Table 264. response description
Path Type Description

[]

Array

array of mailing statuses

filter description

request
GET /api/v2/mailings/10000000111/filter-description HTTP/1.1
Table 265. /api/v2/mailings/{id}/filter-description
Parameter Description

id

mailing id

response
HTTP/1.1 200 OK

<?xml version="1.0" encoding="UTF-8"?>
<table class="border">

    <tr class="commonHeader">

        <th style="text-align: center" colspan="2">Клиент</th>

    </tr>

    <tr>

        <td class="specialTdInternal">Пол клиента</td>

        <td class="specialTdInternal">Мужской</td>

    </tr>
</table>

create mailing

request
POST /api/v2/mailings HTTP/1.1

{
  "filterId" : 9999990001,
  "filter" : {
    "mailingType" : "SMS",
    "ageFrom" : null,
    "ageTo" : null,
    "gender" : null,
    "driver" : null,
    "computer" : null,
    "familyName" : null,
    "cities" : null,
    "departmentIds" : null,
    "birthdayFrom" : null,
    "birthdayTo" : null,
    "lastVisitedOnFrom" : null,
    "lastVisitedOnTo" : null,
    "smsAccepted" : null,
    "emailAccepted" : null,
    "phoneAccepted" : null,
    "mailAccepted" : null,
    "orderType" : null,
    "goodType" : null,
    "ordersSumFrom" : null,
    "ordersSumTo" : null,
    "hasOrders" : null,
    "hasClientCard" : null,
    "cardSumFrom" : null,
    "cardSumTo" : null
  },
  "topic" : null,
  "content" : "Новая рассылка"
}
Table 266. request description
Path Type Description Constraints

filterId

Number

ID готового фильтра

topic

String

Заголовок сообщения (только для email)

Length must be between 0 and 280 inclusive

content

String

Тело сообщения

Length must be between 0 and 50000 inclusive.
Must not be blank

filter

Object

Ручной фильтр

Must not be null

filter.mailingType

String

Тип рассылки [SMS,EMAIL]

filter.ageFrom

Number

filter.ageFrom

filter.ageTo

Number

filter.ageTo

filter.gender

String

[MALE,FEMALE]

filter.driver

Boolean

filter.driver

filter.computer

Boolean

filter.computer

filter.familyName

String

filter.familyName

filter.cities

Array

filter.cities

filter.departmentIds

Array

filter.departmentIds

filter.birthdayFrom

String

filter.birthdayFrom

filter.birthdayTo

String

filter.birthdayTo

filter.lastVisitedOnFrom

String

filter.lastVisitedOnFrom

filter.lastVisitedOnTo

String

filter.lastVisitedOnTo

filter.smsAccepted

Boolean

filter.smsAccepted

filter.emailAccepted

Boolean

filter.emailAccepted

filter.phoneAccepted

Boolean

filter.phoneAccepted

filter.mailAccepted

Boolean

filter.mailAccepted

filter.orderType

String

[SALE,REPAIR,GLASSES,CONTACT_LENS,CHECK_VISION]

filter.goodType

String

[ACCESSORY,CONTACT_LENS,EXTRAS,GLASSES,LENS,SUNGLASSES]

filter.ordersSumFrom

Number

filter.ordersSumFrom

filter.ordersSumTo

Number

filter.ordersSumTo

filter.hasOrders

Boolean

filter.hasOrders

filter.hasClientCard

Boolean

filter.hasClientCard

filter.cardSumFrom

Number

filter.cardSumFrom

filter.cardSumTo

Number

filter.cardSumTo

response
HTTP/1.1 200 OK

stop mailing

request
PUT /api/v2/mailings/10000000001/stop HTTP/1.1
Content-Type: application/x-www-form-urlencoded
response
HTTP/1.1 200 OK