cloud36
cloud36

Reputation: 1066

Google Search API Missing Parameter q

Not sure what I'm doing wrong here. I have been following these instructions fully.

Anyways, I am trying to use Google custom search API. I have my API and CS key. I enter the following, with appropriate info filled in, but it says I am missing the q parameter when I am clearly not. Any ideas what I am doing wrong?

curl https://www.googleapis.com/customsearch/v1?key=INSERT_YOUR_API_KEY&cx=017576662512468239146:omuauf_lfve&q=lectures


{
 "error": {
  "errors": [
    {
    "domain": "global",
    "reason": "required",
    "message": "Required parameter: q",
    "locationType": "parameter",
    "location": "q"
   }
  ],
  "code": 400,
  "message": "Required parameter: q"
 }
}

Upvotes: 2

Views: 3017

Answers (2)

user6848902
user6848902

Reputation:

The Google API states that "q" or the query is necessary to run.

Parameter name Value Description Required query parameters cx string The custom search engine ID to use for this request. q string Query

https://developers.google.com/custom-search/v1/cse/list

Upvotes: 1

T3db0t
T3db0t

Reputation: 3551

The colon in the cx parameter must be URL encoded., i.e. 017576662512468239146%3Aomuauf_lfve. Using jQuery $.get with a params object will do this for you if you like.

Upvotes: 1

Related Questions