2011-08-22 95 views
1

下面的代码:谷歌Places API的,添加的地方总是返回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); 

你能看到什么了吗?

+0

http://stackoverflow.com/questions/7417764/google-places-add-place-invalid-request-error我有同样的问题。你的情况有什么问题? – marcinn

+0

不幸的是,[Place Add](https://developers.google.com/places/web-service/add-place)已于2017年6月30日弃用,并将于2018年6月30日停止使用。因此,您无法使用这种方法了。有关详细信息,请参阅相应的[地理博客文章](https://maps-apis.googleblog.com/2017/06/announcing-deprecation-of-place-add.html)。 – xomena

回答

0

这是一些可能影响响应的因素。以下是在向我的项目添加地点时遇到的问题: 1.'类型'的地方未列入Google了解的类型中。确保添加的类型在supported types中给出。 2. 需要类型都包含在请求放置中。还要确保它的格式符合预期。 (请检查'地址添加'中的request body部分以确保您的请求有效。) 3.发送的请求格式正确,编码为,内容类型为

希望这个答案很有用。

问候, 卡兰

相关问题