0

Please help me with GET request parameters.

The problem: How to enable image search in Google Custom Search API?

The manual is here, but it woks only for web search.

For example doing a web search with text flowers returns:

{https://www.googleapis.com/customsearch/v1?key={MY-KEY}&cx=013036536707430787589:_pqjad5hr1a&q=flowers&alt=json}

Image search should have the extra parameter searchType=image

{https://www.googleapis.com/customsearch/v1?key={MY-KEY}&cx=013036536707430787589:_pqjad5hr1a&q=flowers&searchType=image&alt=json}

But it returns JSON with 0 search results.

Please tell me what I’m doing wrong. Thanks in advance.

3 Answers 3

1

This should be enabled in the search engine configuration (disabled by default). I also spent some time on why it wouldn't work.

Sign up to request clarification or add additional context in comments.

Comments

1

I had the same situation, then I tried to configure the search engine and it worked afterwards

  1. Go to "programmablesearchengine.google.com/controlpanel/all"
  2. FInd your using engine and click
  3. The website will navigate to the control panel
  4. "Overview -> Search function"
  5. Turn on "image search" and "search the entire web

Refer to the image below:

Like this, you maybe need to turn on "image search" and "Search the entire web" option

2 Comments

Could you add in text the configuration settings to change, as images aren't accessible to everyone.
My pologize 1. Go to "programmablesearchengine.google.com/controlpanel/all" 2. FInd your using engine and click 3. The website will navigate to the control panel 4. "Overview -> Search function" 5. Turn on "image search" and "search the entire web"
0

I used the API Explorer to emulate a search and got the corrected URL that way

https://www.googleapis.com/customsearch/v1?q={QUERY}&cx={CX}&{OPTIONS}={VALUES}&key={YOUR_API_KEY}&searchType=image&alt=json

As silly as it sounds, apparently the exact order matters for it to work.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.