LianaMailer REST API

Consents

Server

Define what contacts can agree to, such as receiving newsletters, and record the consents they give or revoke. Each consent type can have translations.


POST
https://rest.lianamailer.com/api
/v1/getConsentTypes

Returns all consent types of the account, ordered by ID. Each consent type includes the latest revision of its translation in every language.

OK

succeed
​boolean

Response status.

Example: true
​ConsentObject[]

POST
https://rest.lianamailer.com/api
/v1/getConsentTypesBySite

Returns the consent types shown on a subscription site, using the latest translation revision in the site's language. Consent types that have no translation in the site's language are not included.

site
​Site · required

Domain name of the subscription site.

Example: site-domain

OK

succeed
​boolean

Response status.

Example: true
​ConsentSiteObject[]

POST
https://rest.lianamailer.com/api
/v1/addMemberConsent

Records that a contact has given a consent. Consent IDs, revisions and languages are listed by getConsentTypes.

If the contact already has the same consent revision in the same language, it is renewed, and a revoked consent becomes valid again.

member_id
​RecipientId · required

Contact ID.

Example: 20000
consent_id
​ConsentId · required

Consent ID.

Example: 4
consent_revision
​ConsentRevision · required

Consent revision number.

Example: 2
lang
​ConsentLang · required

Consent language code, e.g. EN.

Example: EN
source
​Source · required

Source of the consent. REST API callers should use api.

Example: api
source_data
​SourceData

Free-text description of where the consent was given, e.g. a subscription page URL.

Example: example.com/subscribe

OK

succeed
​boolean

Response status.

Example: true
result
​MemberConsentId

Member consent ID.

Example: 123

POST
https://rest.lianamailer.com/api
/v1/revokeMemberConsent

Revokes a contact's consent. All revisions of the consent in the given language are revoked.

Revoke consent › Request Body

member_id
​RecipientId · required

Contact ID.

Example: 20000
consent_id
​ConsentId · required

Consent ID.

Example: 4
consent_revision
​ConsentRevision · required

Consent revision number.

Example: 2
lang
​ConsentLang · required

Consent language code, e.g. EN.

Example: EN

Revoke consent › Responses

OK

succeed
​boolean

Response status.

Example: true
result
​string | null

Returns null.

Example: null

POST
https://rest.lianamailer.com/api
/v1/getMemberConsentUpdates

Returns changes in contacts' consents since from_date.

Returns at most 1000 updates per call, 100 by default. Use offset with the pagination data in the response to get more.

from_date
​FromDate · required

Start date and time as YYYY-MM-DD HH:MM:SS. getUnsubscriptions accepts only YYYY-MM-DD.

Example: 2019-12-20 14:00:00
offset
​Offset

Number of results to skip.

Example: 100
limit
​Limit

Maximum number of results.

Example: 100
consent_id
​ConsentId

Consent ID.

Example: 4

OK

succeed
​boolean

Response status.

Example: true

POST
https://rest.lianamailer.com/api
/v1/createConsentType

Creates a consent type and returns its ID. The new type has no translations: add the title and description shown to contacts with editConsentTranslation.

name
​ConsentTypeName · required

Consent type name.

Example: type
is_revokable
​ConsentRevokable · required

Whether the consent can be revoked.

Example: true

OK

succeed
​boolean

Response status.

Example: true
result
​ConsentId

Consent ID.

Example: 4

POST
https://rest.lianamailer.com/api
/v1/editConsentType

Changes the name and revocability of a consent type. Translations are not changed and no new revision is created; use editConsentTranslation to change the text shown to contacts. Returns 1 even if no consent type has the given ID.

consent_id
​ConsentId · required

Consent ID.

Example: 4
name
​ConsentTypeName · required

Consent type name.

Example: type
is_revokable
​ConsentRevokable · required

Whether the consent can be revoked.

Example: true

OK

succeed
​boolean

Response status.

Example: true
result
​integer

Returns 1 on success.

Example: 1

POST
https://rest.lianamailer.com/api
/v1/editConsentTranslation

Saves a new revision of the consent title and description in one language and returns the revision number. Use this also to add a new language. Earlier revisions are kept, and consents that contacts have already given keep referring to the revision they were given for.

consent_id
​ConsentId · required

Consent ID.

Example: 4
lang
​ConsentLang · required

Consent language code, e.g. EN.

Example: EN
title
​ConsentTitle · required

Consent title.

Example: Example title
description
​ConsentDescription · required

Consent description text.

Example: Example description

OK

succeed
​boolean

Response status.

Example: true
result
​ConsentRevision

Consent revision number.

Example: 2

POST
https://rest.lianamailer.com/api
/v1/deleteConsentType

Permanently deletes a consent type with all its translations. This also deletes all consents that contacts have given for it and removes it from subscription sites. This cannot be undone. Returns 1 even if no consent type has the given ID.

consent_id
​ConsentId · required

Consent ID.

Example: 4

OK

succeed
​boolean

Response status.

Example: true
result
​integer

Returns 1 on success.

Example: 1