Callback method is intended for intensive and consistent scraping (e.g. 5+ SERPs per second) or for those looking to maximize efficiency.

  • Send a POST with a payload to the SERPMaster’s system.
  • Receive a job ID in the response. Connection can then be closed
POST https://api.serpmaster.com/cb
curl -X POST -u username:password 'https://api.serpmaster.com/cb' -d '{"q": "lorem ipsum"}' -H "Content-Type: application/json"
import requests
from pprint import pprint
// Specify content type and form the request body
headers = {'Content-Type': 'application/json'}
job_params = {
    'q': 'lorem ipsum',
}
// Post job and get response
response = requests.post(
    'https://api.serpmaster.com/cb',
    headers=headers,
    json=job_params,
    auth=('username', 'password')
)
// Print the response body
pprint(response.json())
<?php
$ch = curl_init();
#Form the request body
$data = [
    "q" => "lorem ipsum",
];
# Set request headers, authentication and other parameters
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_USERPWD, "username" . ":" . "password");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_URL, "https://api.serpmaster.com/");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
$response = curl_exec($ch);
curl_close($ch);
$json = json_decode($response);
var_dump($json);
?>
  • Once the job is finished we will send a notification to your callback endpoint.
  • Data can then be downloaded by making a GET request to the results API endpoint:
https://api.serpmaster.com/cb/{id}/results
curl --u username:password 'https://api.serpmaster.com/cb/{ID}/results'
import requests
from pprint import pprint

// Get the result
response = requests.get(
    'https://api.serpmaster.com/cb/{JOB}/results',
    auth=('username', 'password')
  
// Print the response body
pprint(response.json())
<?php
$ch = curl_init();

# Set request headers, authentication and other parameters
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "username" . ":" . "password");
curl_setopt($ch, CURLOPT_URL, "https://api.serpmaster.com/cb/{ID}/results");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
curl_close($ch);
$json = json_decode($response);
var_dump($json);
?>

If you are familiar with Webhook, integrating through Callback will be easy. If not, you can just try downloading your results in about 10 seconds after request submission and retry every few seconds if you get a 204 (No Content) response.