繁体   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