Google site search API (now custom search API since Google site search is shutting down) lets you develop applications to get and show results from Google custom/ site search programmatically. Google site search In this article we will discuss the components of the google site search API and where to find them. Google search for sites has many restrictions and you could sign up for expertrec site search engine using the link below.

Create your custom search engine

The usual API call is

Here parameters could be –

  1. q– query string
  2. cx– Custom search engine ID.
  3. fileType– bmp, gif, jpg, png, pdf etc
  4. num-number of search results to display
  5. searchType- search type.
  6. sort-Sort by functionality to use.

For a list of all query parameters, go to this link.

google site search API

A sample api call would be like this-

Response of this API will be in JSON format for you to consume to build your search application.

google site search api

Getting your API Key

  1. Go to https://developers.google.com/custom-search/json-api/v1/overview
  2. Click on get key.google site search api
  3. Click create new project.google site search api
  4. This will generate your new API key.google site search api
  5. You can restrict the usage of this API key in your google api console https://console.developers.google.com/apis

google site search api

Getting your CX / Search engine ID:

Go to your custom search / site search control panel-> edit search engine->Basics->Details->Search engine ID.

This is your search engine ID.

google site search api

If you are finding issues with the Google site search API, you could try out expertrec’s site search API, which is easier to implement.

Expertrec’s Google site search replacement API-

Go to https://cse.expertrec.com?platform=cse  and enter your website and sitemap URLs to get your crawl done. Go and click on your demo link.

Create your custom search engine

  1. In your demo link open developer tools (control+shift+I) on your chrome browser.
  2. Go to network tab.
  3. Go to XHR section.
  4. Search for expertrec.
  5. Click on searchv7…

google site search api

The API will be of this format-

 

Expertrec site search API parameters-

  1. org_id- Your unique ID that identifies your website/ websites.
  2. q- Keyword.
  3. page- pagination
  4. size- number of search results to be displayed.

The results will be in JSON format and will be similar to this screen shot-

 

Create your custom search engine


muthali ganesh

Muthali loves writing about emerging technologies and easy solutions for complex tech issues. You can reach out to him through chat or by raising a support ticket on the left hand side of the page.