本文介绍了没有类型属性的Google Places API INVALID_REQUEST的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

至少这个应该很容易让你验证。此请求返回 INVALID_REQUEST





但是这个工程(正好是相同但带有类型参数):





在文件中它认为类型不是必需的参数,所以它是一个在他们的API错误?

解决方案

这不是一个错误,但预期的行为(我认为不一致的行为,但无论如何)。对于那些有兴趣的人,我在这里得到了我的答案:


At least this one should be easy for you to verify. This request returns an INVALID_REQUEST:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=51.509980,-0.133700&sensor=true&rankby=distance&key=AIzaSyCYURWNpah3uazB9Ss3WX5LImGehyh73V8

But this one works (exactly the same but with a types parameter):

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=51.509980,-0.133700&sensor=true&rankby=distance&key=AIzaSyCYURWNpah3uazB9Ss3WX5LImGehyh73V8&types=food

In the documentation it says that types is not a required parameter so is it a bug in their API?

解决方案

It is not a bug but an expected behaviour (inconsistent behaviour I believe but anyways). For those who are interested, I got my answer here: https://code.google.com/p/gmaps-api-issues/issues/detail?id=5456

这篇关于没有类型属性的Google Places API INVALID_REQUEST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-16 23:57
查看更多