I try to use the Google Places API. This works fine in Postman but when I copy/paste the parameters to my MarkLogic SJS script, things get tricky.
This is my working code, I use this in Postman and can also copy it to my browser and it will work fine.
https://maps.googleapis.com/maps/api/place/textsearch/xml?query=dikw consulting&key=someniceapikeyhere
This is my faulty SJS script:
xdmp.httpGet(
"https://maps.googleapis.com/maps/api/place/textsearch/xml",
{
"headers": {
"query": "dikw consulting",
"key": "someniceapikeyhere"
}
}
)
I have also tried to make the "query parameter" like this:
"query": "dikw consulting&key=someniceapikeyhere"
The error Google returns is this:
<?xml version="1.0" encoding="UTF-8"?>
<PlaceSearchResponse>
<status>REQUEST_DENIED</status>
<error_message>This service requires an API key.</error_message>
</PlaceSearchResponse>
And what about this?
xdmp.httpGet(
"https://maps.googleapis.com/maps/api/place/textsearch/xml?query=dikw+consulting&key=someniceapikey"
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With