6

I am using the Google Custom Search API to search for images. My implementation is using Java, and this is how I build my search string:

URL url = new URL("https://ajax.googleapis.com/ajax/services/search/images?"
                + "v=1.0&q=barack%20obama&userip=INSERT-USER-IP");

How would I modify the URL to limit search results, for example, to: 2014-08-15 and 2014-09-31?

Amr
  • 2,190
  • 2
  • 12
  • 25

1 Answers1

3

You can specify a date range using the sort parameter. For your example, you would add this to your query string: sort=date:r:20140815:20140931.

This is documented at https://developers.google.com/custom-search/docs/structured_data#page_dates

Also if you use Google's Java API you can use the Query class and its setSort() method rather than building the URL by hand.