Skip to content

Update segment

Request

Update a segment.

Security
TdApikeyAuth
Path
audienceIdinteger, (int64)required

Master Segment id of the segment

segmentIdinteger, (int64)required

ID of Segment that needs to be updated

Bodyapplication/json
audienceIdinteger, (int64)
namestring
kindinteger

0: batch, 1: realtime, 2: funnel_stage

funnel_stageobject

required if creating segment as a rule of funnel_stage

descriptionstring
segmentFolderIdinteger, (int64)
rulepartial_v5_rule.yaml-v5IonRule-ionRule (object) or (object or null)(partial_v5_rule.yaml-v5IonRule)
One of:
countPopulationboolean
realtimebooleanDeprecated

use kind instead

curl -i -X PUT \
  'https://api-cdp.treasuredata.com/audiences/{audienceId}/segments/{segmentId}' \
  -H 'Authorization: YOUR_API_KEY_HERE' \
  -H 'Content-Type: application/json' \
  -d '{
    "audienceId": 0,
    "name": "string",
    "realtime": true,
    "kind": 0,
    "funnel_stage": {
      "funnel_id": 0,
      "stage_id": 0
    },
    "description": "string",
    "segmentFolderId": 0,
    "rule": {
      "conditions": [
        {
          "conditions": [
            {
              "exclude": true,
              "id": "string",
              "type": "FunnelStageReference"
            }
          ],
          "description": "string",
          "expr": "string",
          "type": "Or"
        }
      ],
      "expr": "string",
      "limit": {
        "number": 0,
        "orderColumns": [
          {
            "column": "string",
            "order": "ascending",
            "type": "Column"
          }
        ],
        "type": "Count"
      },
      "type": "Or"
    },
    "countPopulation": true
  }'

Responses

successful operation

Bodyapplication/json
audienceIdstring, (integer)
idstring, (integer)
namestring
kindinteger

0: batch, 1: realtime, 2: funnel_stage

descriptionstring or null
segmentFolderIdstring, (integer)
populationinteger or null, (int64)
createdAtstring, (date-time)
updatedAtstring, (date-time)
createdByobject(User)
updatedByobject(User)
rule(SegmentRule (EmptyCondition (object) or AndCondition (object) or OrCondition (object) or CompositeCondition (object))) or (partial_v5_rule.yaml-v5IonRule (partial_v5_rule.yaml-v5IonRule-ionRule (object) or (object or null)))
Any of:
One of:
realtimebooleanDeprecated

Whether the segment is realtime segment or not

Response
{ "audienceId": "string", "id": "string", "name": "string", "realtime": true, "kind": 0, "description": "string", "segmentFolderId": "string", "population": 0, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "createdBy": { "id": "string", "td_user_id": "string", "name": "string" }, "updatedBy": { "id": "string", "td_user_id": "string", "name": "string" }, "rule": {} }