Documentation / Developer / Lytics APIs

Segment Collection

Segment Collections are grouped/named lists of segments. Segments that participate in a collection such as Goals are related. The Lytics App UI has one predefined collection called Goals which defines the main funnel of user conversions for your company. Definining this helps our Machine Learning understand goals.

In addition, the Lytics App has a variety of collections for Aspects on the home page/reporting which are collections of segments on related themes.

  • Email Collection of aspects related to email behavior.

  • Web A variety of aspects of web users.

  • Ecommerce

Segment Collection List

/api/segmentcollection

Get a list of all segment collections.

GET

Segment Collection List

/api/segmentcollection

Get list Segment Collections

Response 200

Headers

Content-Type: application/json

Body

{
    "data": [
        {
          "aid": 0,
          "account_id": "fake46b7afad96f3a4e4b41cee40ecd6",
          "id": "c6f8341eecc4a0aa1ff12cd7f493445c",
          "name": "Goal Funnel",
          "slug_name": "goal_funnel",
          "table": "user",
          "author_id": "1bb376fe32bfa9db34a18b481af2156d",
          "updated": "2016-05-16T22:33:23.699Z",
          "created": "2016-01-08T00:10:20.748Z",
          "internal": false,
          "collection": [
            {
              "id": "2cdf46b7afad96f3a4e4b41cee40ecd6",
              "order": 0
            },
            {
              "id": "a3c8185e14282015039e5ab5b05a0da1",
              "order": 1
            },
            {
              "id": "bdef1f39c6b9cbc46712a836512888d7",
              "order": 2
            },
            {
              "id": "8d469110b2d351c2dcbb36bfb6313c20",
              "order": 3
            }
          ],
          "parent_segment": ""
        }
    ],
    "message": "success",
    "status": 200
}

Segment Collection

/api/segmentcollection/{id}

Get Single segment collection By ID

Parameters
idstring (required)
Ex: 1234abcd
id of segment collection
GET

Segment Collection Fetch

/api/segmentcollection/{id}

Fetch a segment collection by id or slug

Response 200

Headers

Content-Type: application/json

Body

{
    "data":  {
          "aid": 0,
          "account_id": "fake46b7afad96f3a4e4b41cee40ecd6",
          "id": "c6f8341eecc4a0aa1ff12cd7f493445c",
          "name": "Goal Funnel",
          "slug_name": "goal_funnel",
          "table": "user",
          "author_id": "1bb376fe32bfa9db34a18b481af2156d",
          "updated": "2016-05-16T22:33:23.699Z",
          "created": "2016-01-08T00:10:20.748Z",
          "internal": false,
          "collection": [
            {
              "id": "2cdf46b7afad96f3a4e4b41cee40ecd6",
              "order": 0
            },
            {
              "id": "a3c8185e14282015039e5ab5b05a0da1",
              "order": 1
            },
            {
              "id": "bdef1f39c6b9cbc46712a836512888d7",
              "order": 2
            },
            {
              "id": "8d469110b2d351c2dcbb36bfb6313c20",
              "order": 3
            }
          ],
          "parent_segment": ""
    }
}
POST

Segment Collection Create

/api/segmentcollection

Create a new Segment Collection from existing segments.

curl -s -J -XPOST "https://api.lytics.io/api/segmentcollection" -H "Authorization: $LIOKEY" -d '
{
    "name": "My Collection",
    "collection":[
        {"id":"1234abcd", "order": 0}
        , {"id":"3456abcd", "order": 1}
    ]
}
'

Request

Headers

Content-Type: application/json

Body

{
    "name": "Collection Name",
    "collection": [
            {"id":"1234abcd", "order": 0}
            , {"id":"3456abcd", "order": 1}
    ]
}

Response 201

Headers

Content-Type: application/json

Body

{
    "data":  {
          "aid": 0,
          "account_id": "fake46b7afad96f3a4e4b41cee40ecd6",
          "id": "c6f8341eecc4a0aa1ff12cd7f493445c",
          "name": "Goal Funnel",
          "slug_name": "goal_funnel",
          "table": "user",
          "author_id": "1bb376fe32bfa9db34a18b481af2156d",
          "updated": "2016-05-16T22:33:23.699Z",
          "created": "2016-01-08T00:10:20.748Z",
          "internal": false,
          "collection": [
            {
              "id": "2cdf46b7afad96f3a4e4b41cee40ecd6",
              "order": 0
            },
            {
              "id": "a3c8185e14282015039e5ab5b05a0da1",
              "order": 1
            },
            {
              "id": "bdef1f39c6b9cbc46712a836512888d7",
              "order": 2
            },
            {
              "id": "8d469110b2d351c2dcbb36bfb6313c20",
              "order": 3
            }
          ],
          "parent_segment": ""
    }
}
PUT

Segment Collection Update

/api/segmentcollection/{id}

Update a Segment Collection

curl -s -J -XPUT "https://api.lytics.io/api/segmentcollection/1234abcd" -H "Authorization: $LIOKEY" -d '
{
    "name": "My Collection",
    "collection":[
        {"id":"1234abcd", "order": 0}
        , {"id":"3456abcd", "order": 1}
    ]
}
'

Request

Headers

Content-Type: application/json

Body

{
    "name": "Collection Name",
    "collection": [
            {"id":"1234abcd", "order": 0}
            , {"id":"3456abcd", "order": 1}
    ]
}

Response 201

Headers

Content-Type: application/json

Body

{
    "data":  {
          "aid": 0,
          "account_id": "fake46b7afad96f3a4e4b41cee40ecd6",
          "id": "c6f8341eecc4a0aa1ff12cd7f493445c",
          "name": "Goal Funnel",
          "slug_name": "goal_funnel",
          "table": "user",
          "author_id": "1bb376fe32bfa9db34a18b481af2156d",
          "updated": "2016-05-16T22:33:23.699Z",
          "created": "2016-01-08T00:10:20.748Z",
          "internal": false,
          "collection": [
            {
              "id": "2cdf46b7afad96f3a4e4b41cee40ecd6",
              "order": 0
            },
            {
              "id": "a3c8185e14282015039e5ab5b05a0da1",
              "order": 1
            },
            {
              "id": "bdef1f39c6b9cbc46712a836512888d7",
              "order": 2
            },
            {
              "id": "8d469110b2d351c2dcbb36bfb6313c20",
              "order": 3
            }
          ],
          "parent_segment": ""
    }
}
DELETE

Segment Collection Delete

/api/segmentcollection/{id}

Delete a Segment Collection model.

Parameters
idstring (required)
Ex: source::target
ID of the Segment Collection model to delete.

Response 204