Segment

Segment Update

Update A segment.

# You can upsert (insert if new, update if exists)
# by POSTing to api and the ALIAS will be used to lookup
# the existing one and update it.
curl -s -XPOST "https://api.lytics.io/api/segment" \
    -H "Content-type: text/plain" \
    -H "Authorization: $LIOKEY" \
    -d'

FILTER AND (
    visits > 5,
    last_visit >= "now-30d",
    scores.momentum >  10
)
ALIAS our_test_activelist

' | jq '.'


# Json Api Allows a few more fields such as description
curl -s -XPUT "https://api.lytics.io/api/segment/123456id" \
    -H "Authorization: $LIOKEY" \
    -H "Content-type: application/json" \
    -d'
{
    "name":"Most Active Users",
    "segment_ql": "FILTER AND (visits > 5,last_visit >= \"now-30d\", scores.momentum >  10)",
    "slug_name":"our_test_activelist",
    "is_public": true,
    "description":"a description of what this is for"
}
' | jq '.'

put/api/segment/{id}

Request

  • Base URL
    https://api.lytics.io
  • URL
    https://api.lytics.io/api/segment/{id}
  • Auth
    API key in header Authorization

Path parameters

idstring required

id, or slug of a segment, part of url path

Query parameters

account_idstring

Your Lytics account ID.

Response

OK

Example response

{
  "data": {
    "id": "7a7f76ff97ad0e3e96c162f74aee8f8f",
    "account_id": "4f7b525bdba058fc096757a6",
    "author_id": "4f7b525bdba058fc096757a6",
    "kind": "segment",
    "segment_ql": "FILTER AND ( visits > 5, last_visit >= \"2015-04-01 00:00:00Z\", last_visit <  \"2015-04-02 00:00:00Z\")",
    "created": "2014-08-04T21:18:20.124Z",
    "updated": "2014-08-04T21:18:20.124Z",
    "description": "Casual users have been active in the last 90 days and show no extreme behavioral patterns.",
    "name": "Recent Visits",
    "slug_name": "recent_visits",
    "tags": [
      "email_trigger"
    ]
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.