Commonly, pingback is known as a callback function, and postback is referred to as a webhook or HTTP push. With DataForSEO API, the pingback function is like a notification sent to your server upon the completion of a task, while postback is a function that actually sends the results to your server.
When you download examples for a necessary programming language from our documentation, you will find pingback_example
and postback_example
files in the folder.
You can learn more about using Pingbacks and Postbacks in DataForSEO from this video tutorial, and our text guide below.
How to set a task with the pingback option?
- Store the file (e.g. pingback_example.php) on your server.
- When setting a task, specify the path to the Pingback file on your server in the pingback_url parameter.
- Once the task is completed, a new file will be created on your server containing the ID of the completed task(s) and your parameter specified in the “tag” field.
Example:
http://your-server.com/pingscript?id=$id
http://your-server.com/pingscript?id=$id&tag=$tag
How to set a task with the postback option?
- Store the file (e.g. postback_example.php) on your server.
- When setting a task, specify the path to the Postback file on your server in the postback_url parameter.
- In SERP API and Merchant API v3, you also need to specify a postback_data parameter indicating the type of results you wish to receive (regular, advanced, html).
- Once the task is completed, we will send a POST request with the results of the task compressed in the gzip format to the path you specified in the “postback_url” field. In other words, a new file will be created on your server containing the actual results of the task(s) you have set.
Example:
http://your-server.com/postbackscript?id=$id
http://your-server.com/postbackscript?id=$id&tag=$tag
Note 1: In case of any issues on your server’s or database’s side that prevented you from receiving pingbacks/postbacks from our system, you can resend them using the Webhook Resend endpoint. When calling this endpoint, you can specify up to 100 task IDs. You won’t be double-charged for resending pingbacks/postbacks or for using this function.
Note 2: IDs of the tasks set with the “postback_url” parameter will not be provided in the list of completed tasks by the corresponding Tasks Ready endpoint.
DataForSEO uses certain IP addresses for sending pingbacks and postbacks to your server.
Make sure the following IPs are not blocked:
Pingbacks/postbacks (except for HTML)
144.76.154.130
144.76.153.113
144.76.153.106
94.130.155.89
178.63.193.217
94.130.93.29
Pingbacks (HTML only)
94.130.155.89
Pingbacks/postbacks (except for HTML)
195.201.63.107
88.99.215.15
Pingbacks (HTML only)
94.130.155.89