In this article we will see how to use the Google custom search site restricted JSON API.google custom search site restricted json api

Points to remember- (if you do not adhere to the following points your API might not return the search results)

  1. Google Custom Search Site Restricted JSON API is similar to the JSON custom search API.
  2. You can search within 10 or lesser websites using this API.
  3. No daily Query limit.
  4. Make sure that the “search the entire web” is set to OFF.

Create your google custom search from https://cse.google.com

Google Custom Search Site Restricted JSON API is of the following format-

 

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.

Here are the list of all parameters-

google custom search site restricted json api

Here is a sample api call to get search results-

 

Here are the search results in JSON format-

 

How to get your custom search API Key-

  1. Go to https://developers.google.com/custom-search/json-api/v1/overview
  2. Click on get  a key.
  3. Click create new project.
  4. This will generate your new API key.google custom search site restricted json api

Getting your CX / Search engine ID:

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

 

You can test you google custom search api using the google api explorer 

 

Expertrec’s Google custom search replacement API to overcome 

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.

Get your expertrec site search API

Go to https://cse.expertrec.com/csedashboard/home/Status to get your API key

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-

 

 

Get your site search API

 

 


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.