Google Image Search API, does anyone have an example that works?

Fraggle picture Fraggle · Oct 5, 2013 · Viewed 11.9k times · Source

Trying to find out how to do Google image searches via an API / REST call. Apparently the image search API is deprecated and directs us to the Custom Search API.

But my first experiments with the Custom Search API, return results from my own website !!&*%%%$@@!, which is not helpful in the slightest.

I need image results from Google images. Anyone have an example query that works?

Answer

Jun Wei Lee picture Jun Wei Lee · Dec 6, 2013

You will basically want to generate a URL like this. Note the search type parameter at the end.

https://www.googleapis.com/customsearch/v1?key=YOUR API KEY&cx=YOUR CUSTOM SEARCH ENGINE IDENTIFIER&q=your query&searchType=image

You can read more here https://developers.google.com/custom-search/json-api/v1/using_rest

edit: changed searchType to lowercase based on comment below