Update statistics on resource
Description
Update subscription statistics of resource.
Returns a response with task ID without waiting for execution.
URL
Method: POST
https://example.com/api/v1.1/resources/refresh_counters
Request
Parameter | Type | Example | Required | Description |
---|---|---|---|---|
token | string | "abcdefghijklmnqrstuvwxyz" | Yes | API token | id | int | 1 | Yes | Resource ID |
list_id | int | 1 | Yes | Database 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": 24,
"list_id": 1,
"format": "json",
"feedback": {
"type": "JSON",
"url": "http://example.com/receiver"
}
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<id>24</id>
<list_id>1</list_id>
<format>json</format>
<feedback>
<type>JSON</type>
<url>http://example.com/receiver</url>
</feedback>
</xml>
Response example
- JSON
- XML
{
"data": {
"task_id": "c9c3ec48-1bef-4969-9c1a-df39f0c179bb"
},
"error": 0,
"error_text": "Successful operation"
}
<xml>
<data>
<task_id>c9c3ec48-1bef-4969-9c1a-df39f0c179bb</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
{
"token": "abcdefghijklmnqrstuvwxyz",
"task_id": "c9c3ec48-1bef-4969-9c1a-df39f0c179bb"
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<task_id>c9c3ec48-1bef-4969-9c1a-df39f0c179bb</task_id>
</xml>
Response example
- JSON
- XML
{
"data": {
"status": "completed",
"progress": 100,
"result": [
{
"channels": [
{
"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
}
},
{
"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": "email",
"status": {
"all": 1336,
"complained": 0,
"hardbounced": 434,
"invalid": 0,
"subscribed": 842,
"subscribed_sendable": 842,
"suspended": 0,
"unconfirmed": 0,
"unconfirmed_sendable": 0,
"unsubscribed": 60
}
}
],
"in_progress": false,
"last_count_time": "counted at 2024-04-19T13:31:08Z in 231.374251ms",
"list_id": 1,
"refresh_task_id": "",
"updated": "2024-04-19T13:31:08.927Z"
}
]
},
"error": 0,
"error_text": "Successful operation"
}
<xml>
<data>
<status>completed</status>
<progress>100</progress>
<result>
<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>
<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>email</channel>
<status>
<all>1336</all>
<complained>0</complained>
<hardbounced>434</hardbounced>
<invalid>0</invalid>
<subscribed>842</subscribed>
<subscribed_sendable>842</subscribed_sendable>
<suspended>0</suspended>
<unconfirmed>0</unconfirmed>
<unconfirmed_sendable>0</unconfirmed_sendable>
<unsubscribed>60</unsubscribed>
</status>
</channels>
<in_progress>false</in_progress>
<last_count_time>counted at 2024-04-19T13:31:08Z in 231.374251ms</last_count_time>
<list_id>1</list_id>
<refresh_task_id></refresh_task_id>
<updated>2024-04-19T13:31:08.927Z</updated>
</result>
</data>
<error>0</error>
<error_text>Successful operation</error_text>
</xml>