Skip to main content

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

ParameterTypeExampleRequiredDescription
tokenstring"abcdefghijklmnqrstuvwxyz"YesAPI token
idint1YesDatabase ID
resource_idint1YesResource ID
formatJSON object "json"No Response data format
By default – json
feedbackJSON object
"feedback": {
"type": "JSON",
"url": "http://example.com/receiver"
}
NoParameter 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

{
"token": "abcdefghijklmnqrstuvwxyz",
"id": 5,
"resource_id": 24,
"format": "json",
"feedback": {
"type": "JSON",
"url": "http://example.com/receiver"
}
}

Response example

{
"data": {
"task_id": "6908adeb-346e-4f5e-9f68-df062bf795cf"
},
"error": 0,
"error_text": "Successful operation"
}

Response parameters

ParameterTypeDescription
dataJSON objectsContains the task identifier - task_id
errorintError code
error_textstringError text

Checking the task status

URL

Method: POST

https://example.com/api/v1.1/tasks/status

Request parameters

ParameterTypeExampleRequiredDescription
tokenstring"abcdefghijklmnqrstuvwxyz"YesAPI token
task_idstring"518f4997-ec43-4df5-bfd0-093aaacf679f"YesTask ID

Request example

{
"task_id": "930bfdb0-a5a8-4207-a77d-6b989bdea326",
"token": "abcdefghijklmnqrstuvwxyz"
}

Response example

{
"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"
}