Taking the advice from above I abandoned trying to incorporate the google search API directly and instead used the URL approach. Here's what I ended up with in case anyone wants to do this in the future.
var delayMilli = 0;
function fetchURL(sheet,row,urlCell) {
delay(delayMilli)
var row = sheet.getRange(row,1,1,2).getValues()[0];
// This example searches for two terms located in row number "row"
var response = UrlFetchApp.fetch("https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q="+row[1]+"%20"+row[0]);
var data = JSON.parse(response);
if (data.responseData.results[0]) {
var urlString = data.responseData.results[0].url;
urlCell.setValue(urlString);
if (delayMilli >= 0) {
delayMilli -= 5;
}
} else {
// Delay the method and try again.
delayMilli += 100;
fetchURL(sheet,row,urlCell)
}
}
If the response object is empty it's usually because Google has rejected the server call. In the above code, each failed iteration will add 0.1 seconds to the delay time before trying again. Once the calls start going through again without any issues the delay time is slowly reduced back to 0. Seemed to work pretty well for me.
One big drawback is you can't filter your results by image size, restriction level, etc.