Update segment
Description
Updates segment building rules.
Request URL
Method: POST
https://example.com/api/v1.1/segments/update/
Request parameters
| Parameter | Type | Example | Required | Description |
|---|---|---|---|---|
| token | string | "abcdefghijklmnqrstuvwxyz" | Yes | API token |
| format | string | "json" | Yes | Response data format. By default – json |
| list_id | int | 5 | Required for static segments | Database ID |
| id | int | 1 | Yes | Segment ID |
| name | string | "New segment" | Yes | Segment name |
| segment | JSON array | Yes | Queries to update |
Request example
tip
When updating segmentation conditions, the specified profile database cannot be changed
For static segments
- JSON
- XML
{
"token": "abcdefghijklmnqrstuvwxyz"
"list_id":5
"name": "Static segment 2",
"is_static": true,
"is_refresh_daily": false
}
<xml>
<id>2</id>
<list_id>5</list_id>
<name>New segment 2</name>
<is_static>true</is_static>
<is_refresh_daily>false</is_refresh_daily>
<token>abcdefghijklmnqrstuvwxyz</token>
</xml>
For dynamic segments
When updating a dynamic segment, the presence of segmentation rules in the segment field is required.
- JSON
- XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"id": 14,
"list_id": 6,
"name": "Static segment 2",
"is_static": false,
"segment": [
{
"condition": "and",
"limit": 0,
"percent_from": 1,
"list_id": 6,
"percent_to": 99,
"queries": [
{
"compo": "domaingroup",
"name": "email",
"operator": "equal",
"type": "email",
"value": [
{
"name": "domaingroup",
"value": "Yahoo! (US)"
}
]
}
]
}
]
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<id>14</id>
<name>New segment 2</name>
<is_static>false</is_static>
<is_refresh_daily>true</is_refresh_daily>
<segment array="">
<list_id>6</list_id>
<condition>and</condition>
<limit>0</limit>
<percent_from>0</percent_from>
<percent_to>99</percent_to>
<queries array="">
<compo>domaingroup</compo>
<name>email</name>
<operator>equal</operator>
<type>email</type>
<value array="">
<name>domaingroup</name>
<value>Yahoo! (US)</value>
</value>
</queries>
</segment>
</xml>
For updatable segments
- JSON
{
"token": "abcdefghijklmnqrstuvwxyz",
"id": 28,
"list_id": 6,
"name": "Static segment 2",
"is_static": true,
"is_refresh_daily": true,
"segment": [
{
"condition": "and",
"limit": 0,
"percent_from": 1,
"list_id": 6,
"percent_to": 99,
"queries": [
{
"compo": "domaingroup",
"name": "email",
"operator": "equal",
"type": "email",
"value": [
{
"name": "domaingroup",
"value": "Yahoo! (US)"
}
]
}
]
}
]
}
</TabItem>
<TabItem value="XML" label="XML">
```xml
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<id>28</id>
<name>New segment 2</name>
<is_static>true</is_static>
<is_refresh_daily>true</is_refresh_daily>
<segment array="">
<list_id>6</list_id>
<condition>and</condition>
<limit>0</limit>
<percent_from>0</percent_from>
<percent_to>99</percent_to>
<queries array="">
<compo>domaingroup</compo>
<name>email</name>
<operator>equal</operator>
<type>email</type>
<value array="">
<name>domaingroup</name>
<value>Yahoo! (US)</value>
</value>
</queries>
</segment>
</xml>
Response example
- JSON
- XML
{
"data": {
"saved_id": 1
},
"error": 0,
"error_text": "Successful operation"
}
<xml>
<data>
<saved_id>14</saved_id>
</data>
<error>0</error>
<error_text>Successful operation</error_text>
</xml>
Response parameters
| Parameter | Type | Description |
|---|---|---|
| error | int | Error code |
| error_text | string | Error text |
| saved_id | int | Segment ID |