How to get started with Google Custom Search API?

25,156

It is true the docs are quite confusing at the moment.

There are 2 version of Google Custom Search: free (CSE - Custom Search Engine) and paid (GSS - Google site Search).

When using the free one you have 2 options: + implement javascript widget with search box and placeholder for results: https://developers.google.com/custom-search/docs/element - this is a standard way of implementing CSE + use JSON REST api - https://developers.google.com/custom-search/v1/overview - this is experimental feature and has a limited free quota (100 queries as of now)

When using GSS (paid one), you can still use javascript widget, but additionally you get access to XML results: https://developers.google.com/custom-search/docs/snippets#presentation_layer

Ususally first you create a search engine in the Control Panel: http://www.google.com/cse and then you use either js widget to access it or JSON (free but low quota) or XML (paid) feeds via HTTP GET requests from your website.

Share:
25,156
Jess
Author by

Jess

Updated on July 15, 2022

Comments

  • Jess
    Jess almost 2 years

    I'm trying to write a Java program that uses Google's Custom Search API to retrieve search results. As a first-time user of API's, though, the documentation on the website is extremely confusing - does one retrieve results by connecting to the google api link like:

    Google Custom Search API

    (Then once you've connected, how do you display the results? Using BufferedReader gives me a 403 error)

    ...or do you need to download the library and use their GoogleCustomSearch class like:

    java google custom search api

    ? I have the googleux-customsearch jar (from http://blog.lux-medien.com/2011/08/google-custom-search-java-implementation/) and integrated it into Eclipse but I'm not quite sure what import statements I should be using to use these classes (again, first-time user).

    I'm also not quite sure the distinction between the Java client, REST API, and JSON API (are they all the same thing??) as detailed on the Google Custom Search API website...can anyone please clarify? Thanks!

  • Vishnu Raj
    Vishnu Raj over 10 years
    i had a query.i needed google search results as a json format. i tried google.com/…************************b-*****8 url. I have created a free version of google search engine, but I'm getting an error 403 while requesting xml version. Also I didn't find JSON format available,at the reference site it says either xml or xml_no_dtd. url you provided regarding is not available right now.
  • Erick
    Erick over 8 years
    With the free version, what are my options when displaying the search results? Am I able to do a search, download the xml file with the results so that I can reuse at a later point in time? I want to download the file because I have a limit of 100 per day.
  • ida
    ida almost 7 years
    Can you point me to some sample code for the paid version? What I need is a simple interface that can send search query to google and get the results but the number of queries I need is alot so I need the paid version. Is there any limitation on that ?