Update statistics on segment
Description
Update the subscription statistics of the profiles in the segment.
Returns a response with task ID without waiting for execution.
URL
Method: POST
https://example.com/api/v1.1/segments/refresh_counters
Request parameters
Parameter | Type | Example | Required | Description |
---|---|---|---|---|
token | string | "abcdefghijklmnqrstuvwxyz" | Yes | API token |
db_id | int | 3 | Yes, for dynamic request | Database ID |
resource_id | int | 2 | Yes | Resource ID |
id | int | 1 | Yes | Segment ID |
format | int | "json" | No | Response data format By default – json |
Request example
- JSON
- XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"db_id": 1,
"resource_id": 24,
"id": 7,
"format": "json"
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<db_id>1</db_id>
<resource_id>24</resource_id>
<id>7</id>
<format>json</format>
</xml>
Response example
- JSON
- XML
{
"data": {
"task_id": "55a345c8-3d79-47ef-b03e-b84ce8e0c126"
},
"error": 0,
"error_text": "Successful operation"
}
<xml>
<data>
<task_id>55a345c8-3d79-47ef-b03e-b84ce8e0c126</task_id>
</data>
<error>0</error>
<error_text>Successful operation</error_text>
</xml>
Parameter | Type | Description |
---|---|---|
data | JSON objects | Contains the task identifier – task_id |
error | int | Error code |
error_text | string | Error text |
Checking the task status
URL
Method: POST
https://example.com/api/v1.1/tasks/status
Request parameters
Parameter | Type | Example | Required | Description |
---|---|---|---|---|
token | string | "abcdefghijklmnqrstuvwxyz" | Yes | API token |
task_id | string | "518f4997-ec43-4df5-bfd0-093aaacf679f" | Yes | Task ID |
Request example
- JSON
- XML
{
"task_id": "930bfdb0-a5a8-4207-a77d-6b989bdea326",
"token": "abcdefghijklmnqrstuvwxyz"
}
<xml>
<task_id>930bfdb0-a5a8-4207-a77d-6b989bdea326</task_id>
<token>abcdefghijklmnqrstuvwxyz</token>
</xml>
Response example
- JSON
- XML
{
"data": {
"status": "completed",
"progress": 100,
"result": [
{
"channels": [
{
"channel": "email",
"status": {
"subscribed_sendable": 209,
"unconfirmed_sendable": 0
}
},
{
"channel": "push",
"status": {
"subscribed_sendable": 0,
"unconfirmed_sendable": 0
}
},
{
"channel": "sms",
"status": {
"subscribed_sendable": 0,
"unconfirmed_sendable": 0
}
}
],
"in_progress": false,
"list_id": 1,
"refresh_task_id": "",
"resource_id": 27,
"updated": "2024-04-20T09:30:01.583Z"
}
]
},
"error": 0,
"error_text": "Successful operation"
}
<xml>
<data>
<status>completed</status>
<progress>100</progress>
<result>
<channels>
<channel>email</channel>
<status>
<subscribed_sendable>209</subscribed_sendable>
<unconfirmed_sendable>0</unconfirmed_sendable>
</status>
</channels>
<channels>
<channel>push</channel>
<status>
<subscribed_sendable>0</subscribed_sendable>
<unconfirmed_sendable>0</unconfirmed_sendable>
</status>
</channels>
<channels>
<channel>sms</channel>
<status>
<subscribed_sendable>0</subscribed_sendable>
<unconfirmed_sendable>0</unconfirmed_sendable>
</status>
</channels>
<in_progress>false</in_progress>
<list_id>1</list_id>
<refresh_task_id></refresh_task_id>
<resource_id>27</resource_id>
<updated>2024-04-20T09:30:01.583Z</updated>
</result>
</data>
<error>0</error>
<error_text>Successful operation</error_text>
</xml>