MarkLogic Google 地点 API 查询

MarkLogic Google Places API query

我尝试使用 Google 个地方 API。这在 Postman 中工作正常,但是当我 copy/paste 我的 MarkLogic SJS 脚本的参数时,事情变得棘手。

这是我的工作代码,我在 Postman 中使用它,也可以将它复制到我的浏览器,它会正常工作。

https://maps.googleapis.com/maps/api/place/textsearch/xml?query=dikw consulting&key=someniceapikeyhere

这是我的错误 SJS 脚本:

xdmp.httpGet(
    "https://maps.googleapis.com/maps/api/place/textsearch/xml",
    {
        "headers": {
            "query": "dikw consulting",
            "key": "someniceapikeyhere"
        }
    }
)

我也试过把"query parameter"做成这样:

"query": "dikw consulting&key=someniceapikeyhere"

错误Googlereturns是这样的:

<?xml version="1.0" encoding="UTF-8"?>
<PlaceSearchResponse>
  <status>REQUEST_DENIED</status>
  <error_message>This service requires an API key.</error_message>
</PlaceSearchResponse>

那这个呢?

xdmp.httpGet(
"https://maps.googleapis.com/maps/api/place/textsearch/xml?query=dikw+consulting&key=someniceapikey"
)