我相信我已尽一切努力正确设置对距离矩阵 API 的访问。
首先,我创建了一个项目和一个计费帐户。该计费帐户已在此项目上启用。
接下来,我启用了距离矩阵 API 并创建了一个不受限制的(目前)API 密钥。
这就是我调用 Google 距离矩阵 API 的方式:
var requestUri = string.Format("https://maps.googleapis.com/maps/api/distancematrix/xml?units=imperial&mode=driving&origins={0}&destinations={1}&KEY={2}", originAddress, destinationAddress, apiKey);
var request = WebRequest.Create(requestUri);
var response = request.GetResponse();
return XDocument.Load(response.GetResponseStream());
然后解析从此方法返回的 XDocument,并提取我请求计算的距离。
然而,在 2500 个请求之后,我收到了OVER_QUERY_LIMIT
与此消息:
You have exceeded your daily request quota for this API. We recommend registering for a key at the Google Developers Console: https://console.developers.google.com/apis/credentials?project=_
我是否忽略了设置 API 密钥或项目/计费帐户的任何步骤?或者有人能看到我在代码中做错了什么吗?