Http status code 401 with bingmaps with correct credentials provided

Hello community,

I tried to test the bingmaps Locations API within postman in order to get familiar with the API. But the problem is that I get an status code of 401 with every request, though I am providing my personal key with the request. I put the key in an environment in order to hide it from the public.

After this I pasted the same URL into Google Chrome and everything worked fine. After the test with Chrome I returned to Postman and had a look for the response body that showed me that the provided credentials (the key) were correct.

I am now wondering if there is a way to to access the API with Postman.

Thank you for your help in advance!

Hey @ShadowBringer

Welcome to the community! :wave:

Have you tried clearing the cookie in the app and giving it a go? There should be a link to the cookies just under the Send button.

Or maybe going to the request settings tab and disabling the cookie jar?

Hello,

thanks for the quick answer. I enabled the disable cookies setting and checked if there are any cookies. Postman showed that no cookies are available.

Can you share the documentation and the request you’re currently using (mask the sensitive data) - Just so that people can she what’s happen.

Sometimes difficult to explain something without any visual clues :grin:

Yes, I can share the request and the documentation.

The request I am using is the following:
http://dev.virtualearth.net/REST/v1/Locations?postalCode=98052

As method I have set GET.

Under auth I have selected the type "API-Key. As key I provided “key” and as value I provided {{bmKey}}, which is the environment variable. I also selected there to include the key in the request params, so it shows up in params in order to create the same URL as shown in the documentation.

Are the able to put that Auth tab and No Auth then in the params, add key and your environment variable as the key/value pair.

Or you could open a new request tab and add this URL, that should give you the ability to fill in the blanks :grin:

http://dev.virtualearth.net/REST/v1/Locations?postalCode={postalCode}&key={BingMapsKey}
1 Like

Thank you for the help. For some reason this works. I don’t quite understand why but I am pritty happy that this works.

Can you maybe explain why it works with no auth?

Different endpoints authenticate requests in different ways, some add these tokens in to the request Headers and some do this via query parameters.

It’s why I wanted to do a quick check for that APIs Auth method from the documentation. If they provide a URL, that can be added straight into the app to see what needs to be filled in.

Sometimes they provide a Curl request which can also be imported into the app. That might place the Auth method into a header.

It’s not that your not using any Auth, it’s just that you’re not using the helper to do what you did straight into the URL.