I am trying to integrate Salesforce with Google textsearch in order to acquire a JSON response with desired information. My request is getting denied and I can't figure out why. Any help is much appreciated.
httprequest req = new httprequest();
http http = new http();
req.setmethod('GET');
string url = 'https://maps.googleapis.com/maps/api/place/textsearch/json'
+ '?query=' + name + '+'
+ city + '+'
+ state + '+'
+ zipcode
+ '&Key={MY-API-KEY}';
req.setEndpoint(url);
HttpResponse resp = http.send(req);
system.debug(resp.getbody());
string jsonResults = resp.getbody();
The response from this request is:
07:44:31.155 (155112095)|USER_DEBUG|[105]|DEBUG|{ "error_message" : "An internal error was found for this API project.", "html_attributions" : [], "results" : [], "status" : "REQUEST_DENIED" }
key
should be lowercase... It's not exactly a SF question (because looks like callout succeeds, remote site settings are ok etc), there are few similar ones on StackOverflow or on code.google.com boards.