Update statistics on database
Description
Update subscription statistics of profiles in the database.
Returns a response with task ID without waiting for execution.
URL
Method: POST
https://example.com/api/v1.1/databases/refresh_counters
Request parameters
Parameter | Type | Example | Required | Description |
---|---|---|---|---|
token | string | "abcdefghijklmnqrstuvwxyz" | Yes | API token | id | int | 1 | Yes | Database ID |
resource_id | int | 1 | Yes | Resource ID |
format | JSON object | "json" | No | Response data format By default – json |
feedback | JSON object |
| No | Parameter defining the method of sending data about statistics update. Parameter "type" - the format or method used to send the data. "url" - the URL to which the statistics data will be sent. |
Request example
- JSON
- XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"id": 5,
"resource_id": 24,
"format": "json",
"feedback": {
"type": "JSON",
"url": "http://example.com/receiver"
}
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<id>5</id>
<resource_id>24</resource_id>
<format>json</format>
<feedback>
<type>JSON</type>
<url>http://example.com/receiver</url>
</feedback>
</xml>
Response example
- JSON
- XML
{
"data": {
"task_id": "6908adeb-346e-4f5e-9f68-df062bf795cf"
},
"error": 0,
"error_text": "Successful operation"
}
<xml>
<data>
<task_id>6908adeb-346e-4f5e-9f68-df062bf795cf</task_id>
</data>
<error>0</error>
<error_text>Successful operation</error_text>
</xml>
Response parameters
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": {
"all": 1336,
"complained": 0,
"hardbounced": 411,
"invalid": 0,
"subscribed": 925,
"subscribed_sendable": 925,
"suspended": 0,
"unconfirmed": 0,
"unconfirmed_sendable": 0,
"unsubscribed": 0
}
},
{
"channel": "push",
"status": {
"all": 1336,
"complained": 0,
"hardbounced": 0,
"invalid": 0,
"subscribed": 0,
"subscribed_sendable": 0,
"suspended": 0,
"unconfirmed": 0,
"unconfirmed_sendable": 0,
"unsubscribed": 0
}
},
{
"channel": "sms",
"status": {
"all": 1336,
"complained": 0,
"hardbounced": 0,
"invalid": 0,
"subscribed": 0,
"subscribed_sendable": 0,
"suspended": 0,
"unconfirmed": 0,
"unconfirmed_sendable": 0,
"unsubscribed": 0
}
}
],
"in_progress": false,
"last_count_time": "counted at 2024-04-17T21:36:01Z in 82.746959ms",
"refresh_task_id": "",
"resource_id": 24,
"total_count": 1336,
"updated": "2024-04-17T21:36:01.449Z"
}
]
},
"error": 0,
"error_text": "Successful operation"
}
<xml>
<data>
<status>completed</status>
<progress>100</progress>
<result>
<channels>
<channel>email</channel>
<status>
<all>1336</all>
<complained>0</complained>
<hardbounced>411</hardbounced>
<invalid>0</invalid>
<subscribed>925</subscribed>
<subscribed_sendable>925</subscribed_sendable>
<suspended>0</suspended>
<unconfirmed>0</unconfirmed>
<unconfirmed_sendable>0</unconfirmed_sendable>
<unsubscribed>0</unsubscribed>
</status>
</channels>
<channels>
<channel>push</channel>
<status>
<all>1336</all>
<complained>0</complained>
<hardbounced>0</hardbounced>
<invalid>0</invalid>
<subscribed>0</subscribed>
<subscribed_sendable>0</subscribed_sendable>
<suspended>0</suspended>
<unconfirmed>0</unconfirmed>
<unconfirmed_sendable>0</unconfirmed_sendable>
<unsubscribed>0</unsubscribed>
</status>
</channels>
<channels>
<channel>sms</channel>
<status>
<all>1336</all>
<complained>0</complained>
<hardbounced>0</hardbounced>
<invalid>0</invalid>
<subscribed>0</subscribed>
<subscribed_sendable>0</subscribed_sendable>
<suspended>0</suspended>
<unconfirmed>0</unconfirmed>
<unconfirmed_sendable>0</unconfirmed_sendable>
<unsubscribed>0</unsubscribed>
</status>
</channels>
<in_progress>false</in_progress>
<last_count_time>counted at 2024-04-17T21:36:01Z in 82.746959ms</last_count_time>
<refresh_task_id></refresh_task_id>
<resource_id>24</resource_id>
<total_count>1336</total_count>
<updated>2024-04-17T21:36:01.449Z</updated>
</result>
</data>
<error>0</error>
<error_text>Successful operation</error_text>
</xml>