I\'m toying around with IBM worklight, and am trying to create an adapter to feed some data in from the Google places API.
I want to call this URL :
Looks like googleapis will not work if you don't specify Host header inside of your request. After adding it everything works as it should:
This is adapters's XML section
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>https</protocol>
<domain>maps.googleapis.com</domain>
<port>443</port>
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>
This is adapter's JS:
function doGet() {
var input = {
method : 'get',
returnedContentType : 'json',
path : 'maps/api/place/search/json',
headers: {
Host: 'maps.googleapis.com'
},
parameters : {
'key' : 'AIzaSyCTlPms1pvhzeoRrBao5qW-DJMI_CWcbAM',
'location' : '52.0700,1.1400',
'radius' : '10000',
'sensor' : 'false',
'name' : 'coffee'
}
};
var response = WL.Server.invokeHttp(input);
return response;
}
in your adapter there is also an {ADAPTER NAME}.xml
In it, under connectivity under connectionPolicy, there is the protocol. did you change it to https and deploy?