juminoz
juminoz

Reputation: 3218

Google Custom Search for Image Returns 500 Error

Started about 40 hours ago, Google Custom Search when used for image search (searchType=image) always returns 500 error. I have double checked with the APIs documentation and there seems to be no change. This is affecting quite a lot of people as you can see in this forum.

https://productforums.google.com/forum/#!category-topic/customsearch/troubleshooting-and-bugs/4bJPzGPLYfw

This is all I get back in the response:

{
   "error": {
       "code": 500,
       "message": null
   }
}

I have tried calling Google, but they just kept redirecting me to the website where there is absolutely no information relating to this.

Has anyone managed to get this to work or have spoken to a person at Google? We are heavily using this feature and it's very costly to have it down for this long.

Upvotes: 8

Views: 1575

Answers (2)

Ricardo Ferreira
Ricardo Ferreira

Reputation: 616

The solution is simple. You just need to go in the control panel and make sure that "image search" option is active.

enter image description here

Upvotes: 0

Paul-Armand Verhaegen
Paul-Armand Verhaegen

Reputation: 547

We worked around it by removing the searchType=image, and changing the code to traverse the json. The code change below conveys the idea:

from:

$.each(response.items, function(index, item) {
      images.push(item.link);
  });

to:

  $.each(response.items, function(index, item) {
    if ((item.pagemap) && (item.pagemap.cse_image) && (item.pagemap.cse_image[0]) && (item.pagemap.cse_image[0].src)) {
      images.push(item.pagemap.cse_image[0].src);
    }
  });

Hope that helps.

Ps: Not cool, Google, not cool.

EDIT: The above workaround probably isn't what you're searching for since Google Custom Search (CSE) for Images is working again (was out for around 3 days, back on +/- 12/12/2014).

Upvotes: 1

Related Questions