Azure Maps 模糊搜索 API (https://atlas.microsoft.com/search/fuzzy/json?) 适用于 Postman 但在逻辑应用程序上失败

Azure Maps Fuzzy Search API (https://atlas.microsoft.com/search/fuzzy/json?) works on Postman but fails on Logic Apps

我开始在使用 Logic Apps (Azure) 的项目中使用 Azure Maps API。突然 HTTP 操作停止工作,我收到 400 BadRequest 错误。

"error":{ "code": "400 错误请求", "message": "Bad request: one or more parameters were incorrectly specified or are mutually exclusive."

但是,当我使用 Postman 或我的浏览器调用相同的 API 时,它工作正常。

API: https://atlas.microsoft.com/search/fuzzy/json?api-version=1.0&subscription-key=xxxxxxxxxxxxxxxxxxxxxxxxxxx&query=2 5 Donlands Ave 4 Toronto 多伦多 &countrySet=Ca&maxFuzzyLevel=2&limit=1

正如我所提到的,这是有效的,但突然间在没有进行任何更改的情况下逻辑应用程序开始失败。

我也有同样的问题。 我使用地址 rest api 从邮​​政编码中检索城市。

样本:

https://atlas.microsoft.com/search/address/structured/json?subscription-key=mySubcriptionKey&api-version=1.0&postalcode=35000&countrycode=fr&limit=1

像你一样,如果我使用查询客户端,我有一个 400 错误请求和消息: { "error":{ "code": "400 错误请求", "message": "Bad request: one or more parameters were incorrectly specified or are mutually exclusive." } }

请注意,google chrome 的查询正常,但是 return Brave、Edge (chromium) 和 Firefox 的 400 个错误请求。 还要注意示例 web sdk 有同样的问题并且没有更新。

目前,我不知道问题出在哪里。

编辑:经过一番调查,我很确定这是 Microsoft 的问题。 所以,我找到了解决方法。 如果我尝试使用 Firefox 进行查询,默认情况下我有一个 400 和一个带有 chrome 的 200。 我比较了 header,问题出在 accept-language.

默认情况下,Chrome,我有:Accept-Language:fr-FR,fr;q=0.9,en-US;q=0.8,en;q= 0.7 在 Firefox(Brave,Edge 也可能)上,我有:Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3

请注意 fr-FR 和 fr 之间的倒置。 如果我将 Firefox 上的 Accept-Language 从 fr,fr-FR 更改为 FR-fr,fr。有效。

如果我只将 Accept-Language 设置为 "fr",我仍然有一个 400。使用 "Fr-fr"。 所以经过一些测试,我的结论是 atlas 有两个字母 header accept-langage.

的问题

所以在我的 TS/JS 代码中,只需添加带有 4 个字母的 accept-language 即可。

xhr.open('GET', url, true);
xhr.setRequestHeader("Accept-Language", this.acceptLanguage);
xhr.send();

我的看法是服务器/图集的问题,我无法想象微软的这种代码演变^^