2

GeoLocation API の使用

Post Request を送信するたびに、Error Code: 403 Acess not Configured という応答が返されます。

Google API コンソールに記載されているすべての手順に従いました。

以下のURLを使用しています。

URL="https://www.googleapis.com/geolocation/v1/geolocate?key=" および API_KEY="<"My_Key">"

これが私のコードです

HttpClient client = new DefaultHttpClient();
    HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000);
    HttpResponse response;
    try {
        HttpPost post = new HttpPost(URL + API_KEY);
        StringEntity se = new StringEntity(mRequestString);
        post.addHeader("content-type", "application/json");
        post.setEntity(se);
        response = client.execute(post);
        /* Checking response */
        if (response != null) {
            InputStream in = response.getEntity().getContent();
            mJSONResponse = convertStreamToString(in);
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
    return mJSONResponse;

私がいつも得るJSON応答は次のとおりです。

 {
    "error"{
      errors: [
       {
        "domain" : "usageLimits"
         "reason" : "accessNotConfigured"
        "message" : "Access Not Configured"
       }
      ],
      "code" :403
      "message" :"Access Not Configured"
     }
 }  

この問題を乗り越えるために誰か助けてください....

4

1 に答える 1

0

Hereによると、以下の2つのケースで可能です:

ケース 1 : dailyLimitExceededusageLimits

1 日の上限を超えました。

ケース 2 : userRateLimitExceeded usageLimits

API コンソールで構成した、1 ユーザーあたりの 1 秒あたりのリクエスト数の上限を超えました。この制限は、すべてのユーザーに適切なアクセスを許可しながら、1 人または少数のユーザー グループが 1 日の割り当てを使い果たすのを防ぐために構成する必要があります。

それが役立つことを願っています。

于 2013-03-15T09:18:02.787 に答える