Подписки
Каждая операция этой группы: что она принимает, что возвращает и какими ошибками может ответить.
Операции
Newsletters and mailing lists the mailbox receives, found from the List-Unsubscribe header of the mail they send, as the Subscriptions page of the app shows them. Unsubscribe from one sender or a whole domain, or move what they sent and keep moving what they send.
GET/subscriptions
List subscriptions
One row per sender and address it writes to, with how much mail it sent, how much of it is unread and how much arrived in the last 30 days. A key or an app limited to particular addresses lists only the subscriptions delivered to them.
Requires the threads:read scope.
Параметры запроса
statusstringactivelists what still arrives,unsubscribedwhat you left.Одно из"active""unsubscribed"По умолчанию"active"qstringSearches the sender name and address.
До 200 символовsortstringrecentputs the newest mail first,mostthe senders with the most mail,unreadthose with the most unread,namesorts by sender.Одно из"recent""most""unread""name"По умолчанию"recent"limitintegerRows per page.
Не меньше 1Не больше 200По умолчанию50offsetintegerHow many rows to skip, for the next page.
Не меньше 0По умолчанию0addressstringOnly the subscriptions delivered to this address. One the key does not reach lists nothing.
От 3 до 320 символов
Возвращает
A page of subscriptions.
Ошибки
Ошибки, которые может вернуть любая операция400401403404422500Каталог ошибок
Также доступно в
GET/subscriptions/domains
List subscriptions by domain
The same subscriptions, one row per sender domain with the counts of its senders added up, so a company that writes from several addresses is one row.
Requires the threads:read scope.
Параметры запроса
statusstringactivelists what still arrives,unsubscribedwhat you left.Одно из"active""unsubscribed"По умолчанию"active"qstringSearches the sender name and address.
До 200 символовsortstringrecentputs the newest mail first,mostthe senders with the most mail,unreadthose with the most unread,namesorts by sender.Одно из"recent""most""unread""name"По умолчанию"recent"limitintegerRows per page.
Не меньше 1Не больше 200По умолчанию50offsetintegerHow many rows to skip, for the next page.
Не меньше 0По умолчанию0addressstringOnly the subscriptions delivered to this address. One the key does not reach lists nothing.
От 3 до 320 символов
Возвращает
A page of sender domains.
Ошибки
Ошибки, которые может вернуть любая операция400401403404422500Каталог ошибок
Также доступно в
POST/subscriptions/domains/{domain}/unsubscribe
Unsubscribe from a whole domain
Unsubscribes from every sender on the domain that can be unsubscribed without a person opening a page, with one-click or by email. skipped counts the senders that only offer a page, and failed the ones that did not accept it. Unsubscribing works the way the sender asks for it: a one-click request to its unsubscribe address when it offers one, an unsubscribe email from the address the mail arrived at when it gives a mailto, and otherwise the sender's own unsubscribe page in url, which a person has to open. method says which.
Requires the threads:write scope.
Параметры пути
domainstringОбязательноThe sender domain, as
GET /subscriptions/domainsreturns it.
Тело запроса
binbooleanAlso move every conversation from the senders to the Bin.
По умолчаниюfalseaddressstringOnly the subscriptions delivered to this address.
От 3 до 320 символов
Возвращает
What happened to each sender, counted.
Ошибки
Ошибки, которые может вернуть любая операция400401403404422500Каталог ошибок
Также доступно в
POST/subscriptions/{id}/unsubscribe
Unsubscribe from a sender
Unsubscribing works the way the sender asks for it: a one-click request to its unsubscribe address when it offers one, an unsubscribe email from the address the mail arrived at when it gives a mailto, and otherwise the sender's own unsubscribe page in url, which a person has to open. method says which. With bin, every conversation from the sender also moves to the Bin.
Requires the threads:write scope.
Параметры пути
idstringОбязательноThe subscription, as
GET /subscriptionsreturns it.
Тело запроса
binbooleanAlso move every conversation from the sender to the Bin.
По умолчаниюfalse
Возвращает
How it was unsubscribed.
Ошибки
- 422
unsubscribe_unsupported: the sender gives no way to unsubscribe.- 502
unsubscribe_refused: the sender did not accept the one-click request and gives no address to write to.
Ошибки, которые может вернуть любая операция400401403404500Каталог ошибок
Также доступно в
POST/subscriptions/{id}/move
Move what a sender sent
Moves every conversation from the sender to the archive, the Bin or a label. With future, the default, a rule keeps doing it to new mail from the sender to that address, which also needs rules:write. future: false drops a rule made that way before.
Requires the threads:write scope.
Параметры пути
idstringОбязательноThe subscription, as
GET /subscriptionsreturns it.
Тело запроса
destinationstringОбязательноarchive,binorlabel.Одно из"archive""bin""label"labelIdstringThe label to file under when
destinationislabel.Может быть nullОт 1 до 200 символовfuturebooleanAlso keep doing it to new mail from the sender, with a rule. Needs
rules:write.По умолчаниюtrueruleNamestringA name for that rule.
Может быть nullДо 100 символов
Возвращает
How many conversations moved, and the rule.
Ошибки
Ошибки, которые может вернуть любая операция400401403404422500Каталог ошибок
Также доступно в
POST/threads/{id}/unsubscribe
Unsubscribe from the sender of a thread
The Unsubscribe button of the reading pane: finds the subscription behind the newest message of the thread that carries a List-Unsubscribe header and unsubscribes from it. Unsubscribing works the way the sender asks for it: a one-click request to its unsubscribe address when it offers one, an unsubscribe email from the address the mail arrived at when it gives a mailto, and otherwise the sender's own unsubscribe page in url, which a person has to open. method says which.
Requires the threads:write scope.
Параметры пути
idstringОбязательноThe thread, as
GET /threadsreturns it.
Возвращает
How it was unsubscribed.
Ошибки
- 422
unsubscribe_unsupported: the sender gives no way to unsubscribe.- 502
unsubscribe_refused: the sender did not accept the one-click request and gives no address to write to.
Ошибки, которые может вернуть любая операция400401403404500Каталог ошибок
Также доступно в
Объекты
DomainUnsubscribeResultobject
objectstring- Одно из
"domain_unsubscribe" domainstringunsubscribedintegerskippedintegerSenders that only offer a page.
failedintegerbinnedinteger
Subscriptionobject
objectstring- Одно из
"subscription" idstringsenderEmailstringsenderNamestring- Может быть null
recipientstringThe address the mail arrives at.
statusstring- Одно из
"active""unsubscribed" methodstringHow the sender lets you unsubscribe, or null when it gives no way.
Может быть nullОдно из"one-click""email""link"linkUrlstringIts unsubscribe page, when it has one.
Может быть nullunreadintegerrecentintegerMail in the last 30 days.
totalintegersinceUnsubscribedintegerMail that still arrived after you unsubscribed.
lastSeenAtstring- Формат
date-time unsubscribedAtstring- Может быть nullФормат
date-time unsubscribedWithstring- Может быть nullОдно из
"one-click""email""link" futureobjectThe rule that keeps moving its new mail, when there is one.
Может быть nullruleIdstringdestinationstring- Одно из
"archive""bin""label" labelIdstring- Может быть null
SubscriptionDomainobject
objectstring- Одно из
"subscription_domain" domainstringnamestringsampleEmailstringOne sender address on the domain.
sendersintegerunsubscribableintegerSenders that can be unsubscribed without a person opening a page.
unreadintegerrecentintegertotalintegersinceUnsubscribedintegerlastSeenAtstring- Формат
date-time
SubscriptionDomainListobject
objectstring- Одно из
"list" totalintegercountsobjectactiveintegerunsubscribedinteger
hasMoreboolean
SubscriptionListobject
objectstring- Одно из
"list" dataSubscription[]totalintegerRows that match, across every page.
countsobjectactiveintegerunsubscribedinteger
hasMoreboolean
SubscriptionMoveResultobject
objectstring- Одно из
"subscription_move" subscriptionIdstringmovedintegerConversations moved.
ruleIdstringThe rule that keeps moving new mail.
Может быть null
UnsubscribeResultobject
objectstring- Одно из
"unsubscribe" subscriptionIdstringthreadIdstringPresent when it was asked for through a thread.
methodstring- Одно из
"one-click""email""link" urlstringThe page to open when
methodislink, since that one needs a person.Может быть nullbinnedintegerConversations moved to the Bin.