Search code examples
httpgetsearch-enginegoogle-custom-search

How to query google custom search engine for multiple keywords?


According to the https://developers.google.com/custom-search/v1/using_rest

GET https://www.googleapis.com/customsearch/v1?
key=INSERT-YOUR-KEY&cx=013036536707430787589:_pqjad5hr1a&q=flowers&alt=json

If I replace flowers with skyblue I get a response with number of search results. But I want a response for "sky blue"

I tried using q=sky%22blue and sky+blue, I am getting errors. How to query with multiple keywords?


Solution

  • The space needs to be escaped with a backslash:

    q=sky\ blue

    Here is a similar question about escaping characters that may help: http://productforums.google.com/forum/#!topic/commerce-search/sxo5NQ5iAI0