簡體   English   中英

Google Places API,添加位置始終返回INVALID_REQUEST

[英]Google Places API, Adding a place always returns INVALID_REQUEST

這是代碼:

googleMapsAPICall = "https://maps.googleapis.com/maps/api/place/add/json?sensor=true&key=MY_KEY_HERE";
HttpPost post = new HttpPost(googleMapsAPICall);
String postBody = "{\"location\":{\"lat\":-33.8669710,\"lng\":151.1958750},\"accuracy\":50.0,\"name\":\"testingjson\",\"types\":[\"other\"],\"language\":\"en\"}";
StringEntity se = new StringEntity(postBody,HTTP.UTF_8);
post.setEntity(se);
httpClient = new DefaultHttpClient();
response = httpClient.execute(post);

你看錯了嗎?

有許多因素會影響響應。 以下是在向我的項目中添加地點時遇到的問題:1. Google所理解的類型未列出地點的“ 類型 ”。 確保添加的類型受支持的類型中給出。 2. 要求的類型都包含在所下的請求中。 還要確保其格式符合預期。 (請檢查“地方添加”中的請求正文部分,以確保您的請求有效性。)3.發送的請求格式正確,並使用正確的內容類型編碼。

希望這個答案很有用。

問候,卡蘭

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM