none
using uri with '&' in Virtual Earth API throws bad request

    Question

  • I have a uri and i am using the virtual earth api.

    The address when it has & is encoded by Uri.Encodedatastring to %26. But it still throws 400 bad request.  

    http://dev.virtualearth.net/REST/v1/Locations/GB/Units C1 %26 C2 XYZY ?o=xml&key=

    Does the encoding is wrong or it cant handle this address.

    Wednesday, November 7, 2018 4:50 PM

All replies

  • Hi Sunmuk,

    This is not unique to Bing APIs. the "&" character is a variable separator in REST calls.

    For the Locations API see: https://msdn.microsoft.com/en-us/library/ff701714.aspx

    The sample call shown is:

    http://dev.virtualearth.net/REST/v1/Locations/US/WA/98052/Redmond/1%20Microsoft%20Way?o=xml&key=BingMapsKey

    Where you see the "&" character is used to separate values.  Your search above does not look like a valid address or a valid call.  Please review the syntax and sample calls at the link I provided and I am sure you can succeed.

    Sincerely,

    IoTGirl


    Thursday, November 8, 2018 12:54 AM
    Owner