Google custom search JSON API is a RESTFUL API lets you develop applications to get and show search results (Websearch, images) from Google custom search programmatically. With this API, you can use RESTful requests to get either web search or image search results in JSON format.
The existing documentation on creating a google custom search using the API method is confusing and we will try to simplify the process here.
In this article, we will see how we can create a custom search engine using the Google custom search API. We will also see what are the limitations of google’s custom search API and how we can overcome them.
The response of this API will be in JSON format for you to consume to build your search application.
{
"kind": "customsearch#result",
"title": "Jeff Pedowitz - President and CEO - The Pedowitz Group | LinkedIn",
"htmlTitle": "\u003cb\u003eJeff\u003c/b\u003e Pedowitz - President and CEO - The Pedowitz Group | LinkedIn",
"link": "https://www.linkedin.com/in/jeffpedowitz",
"displayLink": "www.linkedin.com",
"snippet": "View Jeff Pedowitz's full profile. It's free! Your colleagues, classmates, and 500 \nmillion other professionals are on LinkedIn. View Jeff's Full Profile ...",
"htmlSnippet": "View \u003cb\u003eJeff\u003c/b\u003e Pedowitz's full profile. It's free! Your colleagues, classmates, and 500 \u003cbr\u003e\nmillion other professionals are on LinkedIn. View \u003cb\u003eJeff's\u003c/b\u003e Full Profile ...",
"formattedUrl": "https://www.linkedin.com/in/jeffpedowitz",
"htmlFormattedUrl": "https://www.linkedin.com/in/\u003cb\u003ejeff\u003c/b\u003epedowitz",
"pagemap": {
"cse_thumbnail": [
{
"width": "276",
"height": "183",
"src": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcT00CLj3qk3NDZp35KPvo4A2kaXF-FrhY7DwtGru9ikLSV2LDmaKneWJT2Z"
}
],
Go to your custom search / site search control panel-> edit search engine->Basics->Details->Search engine ID.
This is your search engine ID.
Testing your google custom search JSON API-
You can test your google custom search API using the Google API explorer
Google Custom search site restricted API
Points to remember- (if you do not adhere to the following points your API might not return the search results)
Google Custom Search Site Restricted JSON API is similar to the JSON custom search API.
You can search within 10 or lesser websites using this API.
No daily Query limit.
Make sure that the “search the entire web” is set to OFF.
Go to your custom search / site search control panel-> edit search engine->Basics->Details->Search engine ID.
You can test your google custom search API using the Google API explorer
The Google Custom Search API allows developers to programmatically retrieve search results from a Google Programmable Search Engine. It returns results in JSON format and can search across specific websites or the entire web.
How do I get a Google Custom Search API key?
Go to the Google Cloud Console, create or select a project, enable the Custom Search JSON API, then generate an API key under Credentials. You also need a Search Engine ID (CX) from cse.google.com.
What are the limits of the Google Custom Search API?
The free tier allows 100 queries per day. Paid usage costs $5 per 1,000 queries up to 10,000 per day. Each query returns a maximum of 10 results, and you can paginate up to 100 results total per query.
New Melchizedec
ExpertRec Search CTO.
Ex-Google Web Search and Google Translate