Reputation: 825
When I call this url from Java code, postman or a web browser
URL:
https://customsearch.googleapis.com/customsearch/v1?key=AIzaSyCca5akhZ492pP08QBchz5Q4QA6kFYsBrc&cx=923a7bcc712ee431d&searchType=image&imgUrl=https://media.gq.com/photos/5a5f79d52316871dcb3c837f/master/w_1600,c_limit/Dua_Lipa_02.jpg
Response:
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"errors": [
{
"message": "Request contains an invalid argument.",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
Upvotes: -1
Views: 327
Reputation: 204
You have to use q argument to define image url instead of imageUrl
https://customsearch.googleapis.com/customsearch/v1?key=AIzaSyCca5akhZ492pP08QBchz5Q4QA6kFYsBrc&cx=923a7bcc712ee431d&searchType=image&q=https://media.gq.com/photos/5a5f79d52316871dcb3c837f/master/w_1600,c_limit/Dua_Lipa_02.jpg
Upvotes: 0