Cheok Yan Cheng
Cheok Yan Cheng

Reputation: 42670

Multiple fileType for Google Custom Search API during image searching

Currently, I'm using Google Custom Search API, to perform image searching using REST

https://developers.google.com/custom-search/json-api/v1/reference/cse/list#request

I was wondering, what is the correct way, to specific multiple file type?

fileType is being mentioned briefly in the API document.

For instance, the following is the GET request, to search only BMP type image.

https://www.googleapis.com/customsearch/v1?key=GOOGLE_API_KEY&cx=GOOGLE_SEARCH_ENGINE_ID&q=picasso&searchType=image&fileType=bmp

However, what if I want to search both PNG and BMP image?

At first, I thought

fileType=png,bmp

might work as mentioned in http://codigogenerativo.com/code/google-custom-search-api/

However, if I test using

https://www.googleapis.com/customsearch/v1?key=GOOGLE_API_KEY&cx=GOOGLE_SEARCH_ENGINE_ID&q=picasso&searchType=image&fileType=png,bmp

JPEG images are being returned.

Seem like my assumption is wrong. Does anyone know how to have multiple fileType for Google Custom Search API during image searching?

p/s Similar question had been raised before few years ago but no concrete answer yet : Multiple file types search using Google Custom Search API

Upvotes: 3

Views: 1651

Answers (1)

Tickle Me Teemo
Tickle Me Teemo

Reputation: 11

https://www.googleapis.com/customsearch/v1?fileType=jpg,png,AND OTHER TYPES YOU NEED&key=GOOGLE_API_KEY&cx=GOOGLE_SEARCH_ENGINE_ID&q=picasso&searchType=image

Upvotes: 1

Related Questions