none
How to fix invalid Key RRS feed

  • Question

  • This is a continuation of this thread in which I was trying to figure out why I was getting an invalid key message.  That thread was in the wrong subforum so I am continuing it here.  The final comment was that "Application keys do not work for REST calls and REST keys do not work for Application calls."  However I cannot find any page to acquire a "REST key" and the documentation makes no mention - that I've found - of a REST key separate from the WPF application key.

    How to proceed?

    EDIT 1

    I *am* using the the REST Toolkit as shown in my reply just below your first post.  I also used the REST Toolkit when I ran the successful Geocoding test.

    The documentation for the ElevationRequest Class is pretty complete on the Toolkit's github site so I'm hard pressed to think it doesn't exist.  If it wasn't working, I'd expect a different error message than the "invalid key" message I am getting.

    I could put my demo app on OneDrive or DropBox if you have access to those portions of the cloud.  Or maybe you could provide me with a one-time key that you know works so I could verify that the problem is not at my end.

    I'm getting disparate to solve this problem so I can move forward with my project so I'll take a chance in public here by posting an email address you can use <deleted> to reply.  If that is beyond your remit, can you provide a different source - preferably within the REST Toolkit team - who can provide a resolution to this vexatious matter.

    Thanks for your assistance so far.

    Roger


    • Edited by RogerSSB Thursday, May 21, 2020 10:04 PM Remove email
    Monday, April 6, 2020 10:21 AM

All replies

  • Hi Roger,

    Please take a look at our licensing page at https://www.microsoft.com/en-us/maps/licensing as the different key types are outlined there.  You will also find that when creating a key in the portal, you can create multiple key types.

    Sincerely,

    IoTGirl

    Monday, April 6, 2020 10:30 PM
    Owner
  • Long delay but I am now back to this issue.

    The licensing options are for different levels of usage, not for different applications.  As far as I can tell, there is no separate license for use of the REST toolkit.

    To check this I wrote to Bing Maps Enterprise Account Administration <mpnet@microsoft.com> and they replied:

    "You should be able to use a basic key for the REST tool kit, you’ll simply be limited to 125,000 transactions per calendar year."

    Well, I'll not make 125K transactions for the rest of my life so that is not a problem.  However, I am still left with the issue that I get this:

    AuthenticationResultCode: NoCredentials

    StatusCode:401

    when I do this:

    Dim Request As ElevationRequest = New ElevationRequest With
    	{
    	.BingMapsKey = "Qs....zF",
    	.Height = ElevationType.Ellipsoid,
    	.Points = pts
    	}
    Dim Reply As Response = Await ServiceManager.GetResponseAsync(Request)
    
    Debug.WriteLine(Reply.AuthenticationResultCode)
    Debug.WriteLine(Reply.StatusCode)
    When I check my account status, my Key is correctly displayed.  So my question remains: What's wrong??

    Monday, May 11, 2020 9:09 PM
  • Hi Roger,

    If you do the REST call directly, do you get the same error? https://docs.microsoft.com/en-us/bingmaps/rest-services/elevations/get-elevations

    Sample Call:

    http://dev.virtualearth.net/REST/v1/Elevation/SeaLevel?points={lat1,long1,lat2,long2,latN,longN}&key={BingMapsAPIKey}

    NOTE: When creating a key, for REST calls you want "General" rather than "Windows Application"

    Sincerely,

    IoTGirl



    Monday, May 11, 2020 9:37 PM
    Owner
  • Your note may have identified the problem.  I only have one key:

    Key type: Basic / Windows Application

    so I decided to create a new key.  However, the only options for Application Type are:

    • Dev/Test
    • Mobile Application
    • Website
    • Windows Application

    Only the last choice applies to my application.  Is this the source of the problem and, if so, how do I get a "General" key?

    Once I post this, I'll try making a REST call directly.



    • Edited by RogerSSB Thursday, May 14, 2020 8:16 AM
    Thursday, May 14, 2020 8:15 AM
  • No, I do not get the error when making direct REST calls.
    Thursday, May 14, 2020 12:41 PM
  • You are correct. The Windows App key is different (Longer) and is expected to come through a Windows call.  Please use the general key (dev/test) and this issue should not occur.
    Friday, May 15, 2020 5:09 PM
    Owner
  • Nope, same bad result.

    Reply.AuthenticationResultCode=NoCredentials
    Reply.StatusCode=401

    Friday, May 15, 2020 7:27 PM
  • Instead of making an ElevationRequest I made a GeocodeRequest.

    That worked fine!!!

    So what is it about an elevation request that is different?

    Sunday, May 17, 2020 5:33 PM
  • Hi Roger,

    I have no idea but I can ask the team.  Do you have a space in the key?  Have you double checked that the format is correct?  Any other steps you can take to simplify the call that is failing?

    Sincerely,

    IoTGirl

    Sunday, May 17, 2020 7:20 PM
    Owner
  • I have created a tiny, stand-alone application that tries to get elevation data and prints out the error messages.  I can zip it up and send it to you so you can run it.

    I assume you can get my email address from my profile.  If you send me an email with the address to send it to, I will.  That's the only way I can see to move beyond this point.

    Tuesday, May 19, 2020 2:02 PM
  • Hi Roger,

    I actually can't get your address as profiles are private. Can you confirm you are doing these calls outside of the REST Toolkit?  It may be that the rest Toolkit does not have support for the elevation call.  

    Sincerely,

    IoTGirl

    Tuesday, May 19, 2020 4:16 PM
    Owner
  • These narrow posts are ridiculous so I'm going to put my reply under EDIT 1 in the OP.
    Wednesday, May 20, 2020 2:23 PM
  • Hi Roger,

    I don't know where that is.  Are you meaning GitHub?

    Sincerely,

    IoTGirl

    Wednesday, May 20, 2020 7:18 PM
    Owner
  • OP = Opening Post.  My first post in this thread.  Right at the top of this very page.  :D
    • Edited by RogerSSB Thursday, May 21, 2020 10:20 AM
    Thursday, May 21, 2020 10:19 AM
  • Hi Roger,

    I have reached out to you over email so you should probably edit it out of OP :)

    Sincerely,

    IoTGirl

    Thursday, May 21, 2020 6:00 PM
    Owner