question

SaifDeanBenMansour-4300 avatar image
1 Vote"
SaifDeanBenMansour-4300 asked ·

Azure Map Search API | Language Parameter is ignored

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.

docs.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
· 2
10 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@SaifDeanBenMansour-4300, Sorry for the delay in responding, Thanks for reaching out to us!,

Using the Accept-Language Parameter instead worked

Could you please provide a screenshot of the request where you have specified 'Accept-Language' and the result is German ?

Please mask sensitive info while providing logs or screenshots.

0 Votes 0 ·

@SaifDeanBenMansour-4300, Just checking back, could you please let us know if you need further help in this matter.

0 Votes 0 ·

1 Answer

KevinFlood-1620 avatar image
2 Votes"
KevinFlood-1620 answered ·

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

10 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.