LianaAutomation

Introduction

The LianaAutomation REST API lets your applications bring events and contacts from external systems to LianaAutomation, search and delete that data, export segments, manage channels, and read automation reports. Responses are JSON.

Regions

Send requests to {API URL}/{endpoint}, using the API URL of your region:

RegionAPI URL
Integrationhttps://rest.automation.lianacloud.com/api/v1

For example, pingpong in the integration region is https://rest.automation.lianacloud.com/api/v1/pingpong. If you are unsure which region your integration uses, contact your account manager.

The Asia (t.asia.lianacem.com) and UAE (t6.lianacem.com) installations accept only the legacy HMAC signature, not Bearer tokens, so this documentation does not cover them.

Requests and responses

Every endpoint takes a POST request with a JSON body. Send {} when the endpoint takes no parameters.

Most errors in the request, such as a missing parameter or a channel that does not exist, return HTTP status 200 with succeed: false and a message:

JSONResponse
{ "succeed": false, "message": "Missing name." }

So check succeed, not just the HTTP status. Other errors return an HTTP error status, with the status repeated in the body:

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

A missing or invalid Authorization header returns 401, also for an endpoint under /api/v1/ that does not exist. A path whose first segment after /api/ is not v1 returns 404.

Long-running requests

Database searches and deletes, exports and automation reports run in the background, in three steps:

  1. Start it with the request endpoint, for example database/search/request. The response holds a handle.
  2. Call the ready endpoint with the handle until it returns "ready": true.
  3. Fetch the outcome from the result endpoint with the same handle.

A database search or delete, or an export, can fail or stop without finishing:

  • If the ready response has error, the job failed. Stop polling and make a new request.
  • Results and errors are kept for about an hour. After that, and for an unknown handle, ready returns "ready": false without error.
  • A job that stops without finishing stays "ready": false, so set an overall deadline for polling.

An automation report returns "ready": true also when it fails, and the error is in the result response.

Make your first request

The pingpong endpoint returns what you send it. Use it to check that your credentials and the connection work.

  1. Get a Bearer token

    Create a client ID and secret in LianaAccount, and request a token with them. The examples request the scope automation-api, which is optional. The token is valid for 15 minutes.

  2. Send the request

    curl --request POST 'https://rest.automation.lianacloud.com/api/v1/pingpong' \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{"ping":"pong"}'
  3. Check the response

    JSONResponse
    { "pong": "pong" }

    A failed request returns an HTTP error status. See Requests and responses.

Next steps

Start with the basics:

  1. Authorization: getting a Bearer token.

Then browse the endpoints:

Last modified on