Geocoder API不断使用正确的appID和appCode给我未经授权的401错误

问题描述 投票:0回答:1

我目前与Geocoder API有关。我不断收到错误消息,(401)未经授权。我正在使用分配给我的app_ID和app_Code。我已经将它们与映射功能一起使用,没有问题。

我正在尝试构建Web应用程序。我需要检索地址的地理编码坐标。我正在将地址传递给以下Geocoder API的searchtext参数:https://geocoder.api.here.com/6.2/geocode.json

using (var w = new WebClient())
    {
       string jsonData = string.Empty;
       string url1 = "https://geocoder.api.here.com/6.2/geocode.json?app_id= <myAppID>&app_code=myAppCode>&searchtext=3003+N+Central+Ave+Phoenix+AZ+85012&gen=9";

       Uri myOrigin = new Uri(url1);
       string myGeocode = string.Empty;

       JObject myObject = new JObject();

       jsonData = w.DownloadString(myOrigin); //FAILS HERE

       myObject = JObject.Parse(jsonData);

    }

我期待一个json响应,其中包含纬度和经度的地理编码坐标。

c# rest json.net geocoding here-api
1个回答
0
投票

问题看起来像带有用户凭据,请为项目页面的请求使用正确的app_id / app_code。

https://developer.here.com/projects

如果有其他问题,请告诉我们。

© www.soinside.com 2019 - 2024. All rights reserved.