2

私はDistance Matrix APIへのアクセスを適切に設定するためにすべてを行ったと思います。Google APIのキーヒットで課金が有効になっていますが、

まず、プロジェクトと請求アカウントを作成しました。この請求アカウントはこのプロジェクトで有効になっています。

次に、私はDistance Matrix 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キーまたはプロジェクト/請求先アカウントを設定するには任意の手順を見落としていますか?または誰かが私のコードで間違っている何かを見ることができますか?

+0

'KEYは=' Googleアカウントがあなたの総ヒット数に関して言うん何小文字の 'キー=' – geocodezip

+0

にする必要がありますか? – Coder

+0

@コーダーそれはまったく打撃ではありません。私はそれを含めるべきだった。私の限界に達したと私に伝えているだけです。 – terbubbs

答えて

1

KEY=ニーズkey=

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 requestUri = string.Format("https://maps.googleapis.com/maps/api/distancematrix/xml?units=imperial&mode=driving&origins={0} 
           &destinations={1}&key={2}", originAddress, destinationAddress, apiKey); 
関連する問題