Azure Map Search API | Language Parameter is ignored

Saif-Dean Ben Mansour 6 Reputation points
2020-05-27T08:09:59.443+00:00

Hello Azure Team,

i was just implementing the Azure Map Search API into our Backend when i noticed that setting the language query parameter didn't have any effect. I checked your documentation site if i did something wrong, then i noticed that the error even appears on your demo page.

learn.microsoft.com/en-us/rest/api/maps/search/getsearchaddress#code-try-0

I filled out the subscription-key and added a language parameter with the value "en-GB" or "en-US" and ran the request.

The result i got was:

{  
  "summary": {  
    "query": "new york city",  
    "queryType": "NON_NEAR",  
    "queryTime": 95,  
    "numResults": 10,  
    "offset": 0,  
    "totalResults": 224,  
    "fuzzyLevel": 1  
  },  
  "results": [  
    {  
      "type": "Geography",  
      "id": "US/GEO/p0/2602",  
      "score": 8.475540161132812,  
      "entityType": "Municipality",  
      "address": {  
        "municipality": "New York",  
        "countrySubdivision": "NY",  
        "countrySubdivisionName": "New York",  
        "countryCode": "US",  
        "country": "Vereinigte Staaten",  
        "countryCodeISO3": "USA",  
        "freeformAddress": "New York, NY"  
      },  

...

When the result was actually german, i knew that my language parameter was being ignored.
Using the Accept-Language Parameter instead worked, when i set the Accept-Language parameter to "en-US" the result was english, but there is also a second bug with Accept-Language.

Accept-Language should actually support "*", "en" or "de" as key, but using any of these keys or even just two letter names, will result in a 400 Bad Request.

So as summary:

  • The Query Language Parameter doesn't work and instead the API is using the Header Accept-Language Parameter
  • Two letter language names aren't supported terms in "Accept-Language" and will result in a 400 Bad Request.
  • The Any Language Wildcard "*" is not supported.

What i actually wanted to do was using the "Any Language" Wildcard and use the language query parameter for user requests, but at this moment, this will not work.

I hope i was able to explain the situation and will be happy to get an answer from you :)

Thanks.

Best Regards

Saif-Dean Ben Mansour

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
587 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Kevin Flood 31 Reputation points
    2020-06-05T07:29:40.943+00:00

    There's related info on this issue here: https://stackoverflow.com/questions/61868237/error-parsing-accept-language-header-in-search-fuzzy-json-api

    Note comment from principle dev manager, Ricky:

    Looks like the team has already been working on part of this. In a couple of days the language parameter will override the accept-language header and should provide one option to move forward. A larger solution is planned for language support in general for later this year which would provide better support for accept-language values. – rbrundritt May 27 at 0:25

    2 people found this answer helpful.
    0 comments No comments