Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MarkLogic Google Places API query

Tags:

marklogic

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>
like image 473
Thijs Avatar asked Jun 08 '26 20:06

Thijs


1 Answers

And what about this?

xdmp.httpGet(
"https://maps.googleapis.com/maps/api/place/textsearch/xml?query=dikw+consulting&key=someniceapikey"
)
like image 58
David Ennis __17llamas __ Avatar answered Jun 11 '26 11:06

David Ennis __17llamas __



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!