Share via

Why does the Bing Maps API Location use an array for resource sets in its response body if they always return 1 resource set?

Anonymous
2021-07-02T11:35:13.743+00:00

I'm going to use the Bing Maps API to find places, and I can't understand why they use as array resources sets and always return only 1 resource set. I could not find this information in the documentation. Maybe they have a reason why they do it.
Does anyone know why?

Response for request query: Denver
{
"authenticationResultCode": "ValidCredentials",
"brandLogoUri": "http://dev.virtualearth.net/Branding/logo_powered_by.png",
"copyright": "Copyright © 2021 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.",
"resourceSets": [
{
"estimatedTotal": 3,
"resources": [
{
"__type": "Location:http://schemas.microsoft.com/search/local/ws/rest/v1",
"bbox": [
39.394721984863281,
-105.71308135986328,
40.087486267089844,
-104.25537872314453
],
"name": "Denver, CO",
"point": {
"type": "Point",
"coordinates": [
39.738452911376953,
-104.98485565185547
]
},
"address": {
"adminDistrict": "CO",
"adminDistrict2": "Denver County",
"countryRegion": "United States",
"formattedAddress": "Denver, CO",
"locality": "Denver"
},
"confidence": "High",
"entityType": "PopulatedPlace",
"geocodePoints": [
{
"type": "Point",
"coordinates": [
39.738452911376953,
-104.98485565185547
],
"calculationMethod": "Rooftop",
"usageTypes": [
"Display"
]
}
],
"matchCodes": [
"Ambiguous"
]
},
{
"__type": "Location:http://schemas.microsoft.com/search/local/ws/rest/v1",
"bbox": [
39.614158630371094,
-105.10982513427734,
39.914108276367188,
-104.59976196289062
],
"name": "Denver County",
"point": {
"type": "Point",
"coordinates": [
39.738452911376953,
-104.98485565185547
]
},
"address": {
"adminDistrict": "CO",
"adminDistrict2": "Denver County",
"countryRegion": "United States",
"formattedAddress": "Denver County"
},
"confidence": "Low",
"entityType": "AdminDivision2",
"geocodePoints": [
{
"type": "Point",
"coordinates": [
39.738452911376953,
-104.98485565185547
],
"calculationMethod": "Rooftop",
"usageTypes": [
"Display"
]
}
],
"matchCodes": [
"Ambiguous"
]
},
{
"__type": "Location:http://schemas.microsoft.com/search/local/ws/rest/v1",
"bbox": [
40.221256256103516,
-76.1585693359375,
40.246849060058594,
-76.124885559082031
],
"name": "Denver, PA",
"point": {
"type": "Point",
"coordinates": [
40.234416961669922,
-76.139396667480469
]
},
"address": {
"adminDistrict": "PA",
"adminDistrict2": "Lancaster County",
"countryRegion": "United States",
"formattedAddress": "Denver, PA",
"locality": "Denver"
},
"confidence": "Low",
"entityType": "PopulatedPlace",
"geocodePoints": [
{
"type": "Point",
"coordinates": [
40.234416961669922,
-76.139396667480469
],
"calculationMethod": "Rooftop",
"usageTypes": [
"Display"
]
}
],
"matchCodes": [
"Ambiguous"
]
}
]
}
],
"statusCode": 200,
"statusDescription": "OK",
"traceId": "fb400f3f713842efa838d9d632d429fb|DU00000D71|0.0.0.1|Ref A: 67A3CD9AF489429B9D40FA0529AE8DD2 Ref B: DB3EDGE1109 Ref C: 2021-07-02T14:23:50Z"
}

Azure Maps
Azure Maps

An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.

0 comments No comments

2 answers

Sort by: Most helpful
  1. rbrundritt 21,711 Reputation points Volunteer Moderator
    2021-07-02T18:03:55.267+00:00

    I suspect this is for consistency, as the route service rourseSet value can return have multiple values in it. By making the resourceSet an array for both services, a common base response class can be used.

    Was this answer helpful?

    1 person found this answer helpful.

  2. IoTGirl 3,961 Reputation points Microsoft Employee Moderator
    2021-07-06T02:42:16.793+00:00

    Please see the documentation https://learn.microsoft.com/en-us/bingmaps/rest-services/common-response-description

    It seems fairly straight forward that the resourcesets tag separates the result contents from the job header. Maybe this process examples will help with your understanding...https://learn.microsoft.com/en-us/bingmaps/v8-web-control/map-control-concepts/rest-services-examples/

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.