Callback Mechanism

This documentation explains how to use the NetNut SERP API to test callback functionality by sending a POST request to your own endpoint.

Parameters for Callback

The SERP API provides three optional parameters for localization:

  • The SERP API supports sending POST requests to a specified URL using a JSON body that defines the method and the url. This can be done by sending a standard search request while including the target callback endpoint in the payload.

POST Body Parameters:

  • url (Required): The full endpoint you want us to send the callback to.

  • method (optional): The HTTP method to use for the callback. The default is using "post".

Example API Request

This example demonstrates how to send a POST request to the NetNut SERP API, instructing it to forward results to a specified URL.

Bash (cURL)

curl --location 'https://serp-api.netnut.io/search?hl=en&q=how%20does%20iphone%20works&uule=new%20york&rawHtml=1' \
--header 'Authorization: Basic base64(username:password)' \
--header 'Content-Type: application/json' \
--data '{
  "method": "post",
  "url": "https://your-callback-url.com"
}'

API Response

The API response can be received in one of two ways, depending on how the customer uses the rawHtml parameter:

  • If rawHtml=0 or rawHtml=1 is used, the response will be returned in JSON format.

  • If rawHtml=2 is used, the response will be returned in raw HTML format, allowing customers to parse the data themselves.

If rawHtml=2 is used, the response will be returned the raw HTML wrapped in JSON format, allowing customers to parse the data themselves.

Last updated