Search code examples
javascriptajaxangularjsgoogle-custom-search

Google Custom Search API javascript


I'm writing an AngularJS application which should perform image search through entire web using google custom search api. I've used the query as follows:

'https://www.googleapis.com/customsearch/v1?key='+ googleApiKey + '&cx=014766414461901118935:knbecyxzx4u&searchType=image&startIndex=41&imgType=photo&q=' + query;

As a result I get an array which consists of 10 elements. The documentation says that it can return up to the first 100 results. How can I load all the rest of results beside those 10 which come from the query above?

Note: Besides the array of images I also get the query object which has the nextPage object which holds the metadata describing the query to use for the next page of results, but apparently I have no idea how to use it as the startIndex value is always 11


Solution

  • I believe that you use &start instead of &startIndex