How do I set up google's custom search API?

How do I set up google's custom search API?
0

#1

I have created a new project in my google api dashboard, but when I use the sandbox for the API, it gives me an error. I am really stuck here. When I try to create my custom search engine ID, it expects a domain to search, but I want to search google…

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "conditionNotMet",
    "message": "Need to provide a Custom Search Engine ID. Missing cx or cref parameter.",
    "locationType": "header",
    "location": "If-Match"
   }
  ],
  "code": 412,
  "message": "Need to provide a Custom Search Engine ID. Missing cx or cref parameter."
 }
}

#2

you need to provide these parameterse…

cx: "your custom search id"
key: “custom search api key”

Final request to be made to url is:-

https://www.googleapis.com/customsearch/v1?q={query to be search}&searchType=image&cx={youe-cs-key}&key={your cse api key}


#3

thansk for the reply, i hope this helps someone or me in the future. I went with a different API for the project.