If you set tasks with webhooks (pingbacks or postbacks) but didn’t receive any data due to a server error, there is no need to spend money on sending requests to our APIs again. Instead, use the Errors and Webhook Resend endpoints to resend task results or completed task notifications to your server for free.
The Errors endpoints will provide you with the IDs of the tasks that returned an error within the past 24 hours.
Let’s refer to the Errors endpoint of SERP API.
POST https://api.dataforseo.com/v3/serp/errors
To send a request, you can specify one of the following optional parameters: limit
, offset
, and filtered_function
.
1 limit
is the maximum number of IDs returned in the response. You can set it from 1 to 1000. Default value: 1000.
2 The offset
parameter can help when you need to collect more than 1000 task IDs. For example, if you have 1500 tasks IDs and have already received the first 1000 IDs, set a task with "offset": 1000
to omit the first 1000 results and receive data for the successive 500 tasks.
3 filtered_function
is a filter that you can use to obtain a list of tasks that returned an error filtered by a certain function. For example, to receive a list of tasks with pingback errors, you can set a task with the following filter: "filtered_function": "pingback_url"
Your POST request should be structured as in the following example:
[
{
"limit": 10,
"offset": 0,
"filtered_function": "pingback_url"
}
]
Example of the API response:
{
"version": "0.1.20220321",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1538 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "03211158-0001-0229-1000-435363e71b2e",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0401 sec.",
"cost": 0,
"result_count": 4,
"path": [
"v3",
"serp",
"errors"
],
"data": {
"api": "serp",
"function": "errors",
"limit": 10,
"offset": 0,
"filtered_function": "pingback_url"
},
"result": [
{
"id": "03211137-0001-0183-0000-39f10d5940fa",
"datetime": "2022-03-21 11:38:16",
"function": "pingback_url",
"error_code": 0,
"error_message": "https://your-server.com/pingback.php?task_id=03211137-0001-0183-0000-39f10d5940fa&api=serp&function=task_get",
"http_url": "https://your-server.com/pingback.php?task_id=03211137-0001-0183-0000-39f10d5940fa&api=serp&function=task_get",
"http_method": "GET",
"http_code": 0,
"http_time": 10.00585,
"http_response": "Operation timed out after 10001 milliseconds with 0 bytes received"
},
{
"id": "03211137-0001-0183-0000-ef9decb5fa04",
"datetime": "2022-03-21 11:37:57",
"function": "pingback_url",
"error_code": 0,
"error_message": "https://your-server.com/pingback.php?task_id=03211137-0001-0183-0000-ef9decb5fa04&api=serp&function=task_get",
"http_url": "https://your-server.com/pingback.php?task_id=03211137-0001-0183-0000-ef9decb5fa04&api=serp&function=task_get",
"http_method": "GET",
"http_code": 0,
"http_time": 10.00574,
"http_response": "Operation timed out after 10001 milliseconds with 0 bytes received"
},
{
"id": "03201639-0001-0183-0000-87baacf9229a",
"datetime": "2022-03-20 16:40:23",
"function": "pingback_url",
"error_code": 0,
"error_message": "https://your-server.com/pingback.php?task_id=03201639-0001-0183-0000-87baacf9229a&api=serp&function=task_get",
"http_url": "https://your-server.com/pingback.php?task_id=03201639-0001-0183-0000-87baacf9229a&api=serp&function=task_get",
"http_method": "GET",
"http_code": 0,
"http_time": 10.005972,
"http_response": "Operation timed out after 10001 milliseconds with 0 bytes received"
},
{
"id": "03201639-0001-0183-0000-3eb962033921",
"datetime": "2022-03-20 16:40:09",
"function": "pingback_url",
"error_code": 0,
"error_message": "https://your-server.com/pingback.php?task_id=03201639-0001-0183-0000-3eb962033921&api=serp&function=task_get",
"http_url": "https://your-server.com/pingback.php?task_id=03201639-0001-0183-0000-3eb962033921&api=serp&function=task_get",
"http_method": "GET",
"http_code": 0,
"http_time": 10.005949,
"http_response": "Operation timed out after 10001 milliseconds with 0 bytes received"
}
]
}
]
}
Once you collect the IDs, send them to the Webhook Resend endpoint.
POST https://api.dataforseo.com/v3/appendix/webhook_resend
You can specify up to 100 IDs in a single request.
Request example:
[
{
"id": "08161139-0001-0066-1000-06491d097ed5"
}
]
To send a request with multiple IDs, structure it the following way:
[
{
"id": "08161139-0001-0066-1000-06491d097ed5"
},
{
"id": "08161139-0001-0066-1000-06491d097ed9"
},
{
"id": "08161339-0001-0066-1000-02431d097ed2"
}
]
Example of the API response:
{
"version": "0.1.20210818",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1337 sec.",
"cost": 0,
"tasks_count": 3,
"tasks_error": 0,
"tasks": [
{
"id": "08161139-0001-0066-1000-06491d097ed5",
"status_code": 20100,
"status_message": "Task Created.",
"time": "0.0082 sec.",
"cost": 0,
"result_count": 0,
"path": [
"v3",
"appendix",
"webhook_resend"
],
"data": {
"api": "serp",
"function": "task_post",
"id": "08161340-0001-0066-1000-8b091c8489db",
"se": "google",
"se_type": "organic",
"language_name": "English",
"location_name": "London,England,United Kingdom",
"keyword": "marcus rashford",
"priority": 2,
"pingback_url": "https://your-server.com/pingscript?id=$id&tag=$tag",
"device": "desktop",
"os": "windows"
},
"result": null
},
{
"id": "08161340-0001-0066-1000-8b091c84af4f",
"status_code": 20100,
"status_message": "Task Created.",
"time": "0.0087 sec.",
"cost": 0,
"result_count": 0,
"path": [
"v3",
"appendix",
"webhook_resend"
],
"data": {
"api": "serp",
"function": "task_post",
"se": "google",
"se_type": "organic",
"language_name": "English",
"location_name": "London,England,United Kingdom",
"keyword": "marcus rashford",
"priority": 2,
"postback_url": "https://your-server.com/postbackscript.php?id=$id&tag=$tag",
"postback_data": "advanced",
"device": "desktop",
"os": "windows"
},
"result": null
},
{
"id": "08161703-0001-0066-1000-597aa65619fc",
"status_code": 40503,
"status_message": "'pingback' or 'postback' not supported in this function.",
"time": "0.0045 sec.",
"cost": 0,
"result_count": 0,
"path": [
"v3",
"appendix",
"webhook_resend"
],
"data": {
"api": "serp",
"function": "task_post",
"language_name": "English",
"location_name": "London,England,United Kingdom",
"keyword": "marcus rashford",
"priority": 2,
"se": "google",
"se_type": "organic",
"device": "desktop",
"os": "windows"
},
"result": null
}
]
}
Once you send a request, the data will be immediately resent to your server.