LianaAutomation REST API documentation (1.0)

Download OpenAPI specification:Download

LianaAutomation REST API documentation.

Quick reference

Your requests needs the following headers:

  • Date: Timestamp in ISO 8601
  • Authorization: See below
  • Content-md5: md5 hash of the body request
  • Content-type: application/json

Authorization header

All requests must include HTTP Authorization header with correct signature. The header is valid for 15 minutes, based on given timestamp.

Format of the HTTP Authorization header:

REALM USERID:SIGNATURE

Computing signature

Signature is generated using HMAC with SHA-256 algorithm.

The key for HMAC is the REST user password and the message is constructed in the following way:

  • Every item on it's own line, add to the string:
    • Request method: POST.
    • Content MD5: The same as in the Content-md5 header.
    • Content Type: The same as in the Content-Type header, being application/json.
    • Date: The same timestamp as in the Date header.
    • Content: The full body content.
    • Path: The path part of the URI, including any query parameters.

Example:

POST
b41c090e9b32a3f85c631db1af38b0af
application/json
2099-01-01 00:00:00+0200
{"ping":"pong"}
/rest/v1/pingpong

HMAC_SHA256("password", message)
= d0e9d4895b0a06e19623b6c63cf6b173d9fa8ca3427ccb680c22209b90d7bb5e

Error responses

Failure of providing the correct headers and authentication can result in the following errors. Note that the HTTP response code remains 200 OK.

"message": "RESTv1 unauthorized login attempt: Checksum does not match!"

The body checksum calculated on the server does not match the header Content-md5

"message": "RESTv1 unauthorized login attempt: User not valid!"

An invalid user was provided. Check if you provided the correct USERID.

"message": "RESTv1 unauthorized login attempt: Hash mismatch!"

The signature part of the authorization header does not match the calculated signature by the server. Possibly a wrong API key or other variable was used when calculating the signature

{"message":"Not found","status":404,"status_message":"Not Found"}

Either a wrong url or REALM was used when making the API call.

Ping

Test connection

pingpong

This utility function can be used for verifying connections with the LianaAutomation REST API. This is the first command you should try out before investing time into the more complex ones

Request Body schema: application/json
ping
string

Responses

Request samples

Content type
application/json
{
  • "ping": "pong"
}

Response samples

Content type
application/json
{
  • "pong": "pong"
}

Import

Import events

import

Bring data to LianaAutomation from external systems.

Request Body schema: application/json
channel
required
string

The channel system name or ID. Channel ID is used to track the source of the data. Can be found from LianaAutomation under Settings from the Admin Channels -page

no_duplicates
boolean

If true, do not create a new duplicate event when an identical event already exists. Automations will not be triggered.

skip_automations
boolean

If true, this import will not trigger automations.

required
Array of objects

An array of multiple identities and events related to that identity.

Responses

Request samples

Content type
application/json
{
  • "channel": "string",
  • "no_duplicates": true,
  • "skip_automations": true,
  • "data": [
    ]
}

Response samples

Content type
application/json
{
  • "succeed": true,
  • "handle": "string"
}

Database

Query database

search/request

Make a database search request

Request Body schema: application/json
channels
Array of strings

Channels to search from

verbs
Array of strings

Event types to search for

from
string <date-time>

Event is newer than

to
string <date-time>

Event is older than

include_data
boolean

Include event data in response

limit
integer
Default: 10000

Limit event count in result. Maximum is 10000

offset
integer

Offset for traversing large event counts

Array of objects

Persons to search for

Responses

Request samples

Content type
application/json
{
  • "channels": [
    ],
  • "verbs": [
    ],
  • "from": "2019-08-24T14:15:22Z",
  • "to": "2019-08-24T14:15:22Z",
  • "include_data": true,
  • "limit": 10000,
  • "offset": 0,
  • "identities": [
    ]
}

Response samples

Content type
application/json
{
  • "handle": "1234"
}

search/ready

Check if a requested database search is completed.

Request Body schema: application/json
handle
string

The handle returned as response from the initial request

Responses

Request samples

Content type
application/json
{
  • "handle": "1234"
}

Response samples

Content type
application/json
{
  • "ready": true
}

search/result

Fetch search results of a finished request

Request Body schema: application/json
handle
string

The handle returned as response from the initial request

Responses

Request samples

Content type
application/json
{
  • "handle": "1234"
}

Response samples

Content type
application/json
[
  • {
    }
]

delete/request

Request data to be deleted from database.

Request Body schema: application/json
channels
Array of strings

Channels to delete from

Array of objects

Persons to delete

Responses

Request samples

Content type
application/json
{
  • "channels": [
    ],
  • "identities": [
    ]
}

Response samples

Content type
application/json
{
  • "handle": "1234"
}

delete/ready

Check if a delete request is finished.

Request Body schema: application/json
handle
string

The handle returned as response from the initial request

Responses

Request samples

Content type
application/json
{
  • "handle": "1234"
}

Response samples

Content type
application/json
{
  • "ready": true
}

delete/result

Returns LianaAutomation system id of the deleted items.

Request Body schema: application/json
handle
string

The handle returned as response from the initial request

Responses

Request samples

Content type
application/json
{
  • "handle": "1234"
}

Response samples

Content type
application/json
{
  • "deleted": [
    ]
}

Export

Export data

export/request

Make a request to export the contents of a given segment.

Request Body schema: application/json
integer (components-schemas-RequestIn)

Segment ID

Responses

Request samples

Content type
application/json
1

Response samples

Content type
application/json
{
  • "handle": "1234"
}

export/ready

Check if an export request is ready.

Request Body schema: application/json
handle
string

The handle returned as response from the initial request

Responses

Request samples

Content type
application/json
{
  • "handle": "1234"
}

Response samples

Content type
application/json
{
  • "ready": true
}

export/result

Export results of a finished export request.

Request Body schema: application/json
handle
string

The handle returned as response from the initial request

Responses

Request samples

Content type
application/json
{
  • "handle": "1234"
}

Response samples

Content type
application/json
[
  • {
    }
]

Segment

Segment management

segment/list

List of segments.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Channel

channel/list

List of channels. Depending on channel type different fields will be returned.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

channel/create

Create channel. Only channels without type can be created.

Request Body schema: application/json
name
required
string
color
string
tracking_enabled
boolean
Default: false
notes
string

Responses

Request samples

Content type
application/json
{
  • "name": "Automation",
  • "color": "#37aef3",
  • "tracking_enabled": true,
  • "notes": ""
}

Response samples

Content type
application/json
{
  • "id": 1,
  • "name": "Automation",
  • "color": "#37aef3",
  • "front_url": "//t.lianacem.com",
  • "icon": "",
  • "tracking_enabled": true,
  • "notes": "",
  • "system_name": "",
  • "tracking_js": "",
  • "import_js": "",
  • "verbs": {
    },
  • "type": "empty",
  • "default_url": "",
  • "events": 100
}

channel/edit

Edit channel. Only channels without type can be edited.

Request Body schema: application/json
id
required
integer
name
string
color
string
tracking_enabled
boolean
Default: false
notes
string

Responses

Request samples

Content type
application/json
{
  • "id": 10,
  • "name": "Automation",
  • "color": "#37aef3",
  • "tracking_enabled": true,
  • "notes": ""
}

Response samples

Content type
application/json
{
  • "id": 1,
  • "name": "Automation",
  • "color": "#37aef3",
  • "front_url": "//t.lianacem.com",
  • "icon": "",
  • "tracking_enabled": true,
  • "notes": "",
  • "system_name": "",
  • "tracking_js": "",
  • "import_js": "",
  • "verbs": {
    },
  • "type": "empty",
  • "default_url": "",
  • "events": 100
}

channel/delete

Delete channel. Channel can be deleted only if it doesn't have type, events and is not used in any automation or segment.

Request Body schema: application/json
id
required
integer

Responses

Request samples

Content type
application/json
{
  • "id": 10
}

Response samples

Content type
application/json
{
  • "succeed": true
}

Report

automations/request

Make a automations report request

Request Body schema: application/json
start_date
required
string
end_date
required
string

Responses

Request samples

Content type
application/json
{
  • "start_date": "2022-02-01",
  • "end_date": "2022-02-25"
}

Response samples

Content type
application/json
{
  • "handle": "1234"
}

automations/ready

Check if a requested automations report is completed.

Request Body schema: application/json
handle
string

The handle returned as response from the initial request

Responses

Request samples

Content type
application/json
{
  • "handle": "1234"
}

Response samples

Content type
application/json
{
  • "ready": true
}

automations/result

Fetch results of a finished request

Request Body schema: application/json
handle
string

The handle returned as response from the initial request

Responses

Request samples

Content type
application/json
{
  • "handle": "1234"
}

Response samples

Content type
application/json
[
  • {
    }
]

Form

form/list

List of forms.

Responses

Response samples

Content type
application/json
[
  • {
    }
]