1

我使用 GMB API 从我的 GMB 帐户中检索位置信息。如果我想选择所有位置没问题,但我无法使用过滤器参数选择相关子集。

检索我使用的所有位置时:

获取https://mybusiness.googlapis.com/v4/accounts/xxxx/locations

当我使用过滤时,我这样做:

GET https://mybusiness.googlapis.com/v4/accounts/xxxx/locations?filter=%22storeCode='RT-1'%22
--> this still gives all results

GET https://mybusiness.googlapis.com/v4/accounts/xxxx/locations?filter=%22location.storeCode='RT-1'%22
--> this still gives all results 

GET https://mybusiness.googlapis.com/v4/accounts/xxxx/locations?filter=%22store_code='RT-1'%22
--> this still gives all results

GET https://mybusiness.googlapis.com/v4/accounts/xxxx/locations?filter=%22location.store_code='RT-1'%22
--> this still gives all results

GET https://mybusiness.googlapis.com/v4/accounts/xxxx/locations?filter=store_code=%22'RT-1'%22
--> gives no results, but also not an error message

GET https://mybusiness.googlapis.com/v4/accounts/xxxx/locations?filter=store_code=%22RT-1%22
--> gives no results, but also not an error message

GET https://mybusiness.googlapis.com/v4/accounts/xxxx/locations?filter=location.store_code=%22RT-1%22
--> gives no results, but also not an error message

GET https://mybusiness.googlapis.com/v4/accounts/xxxx/locations?filter=location.storeCode=%22RT-1%22
--> gives no results, but also not an error message

Could someone please point me a working solution?

I read through pages of documentation, but they give different stories. I also tried to filter with other attributes, but that appears not to be different. Next to that, the Google documentation states I can use all fields to filter.

To support my statements I used OAuth2 playground, so no programming issues. Authentication is not the problem since I can retrieve the complete list of locations.

Hope someone can help me! And if you also have an example of the 'orderBy' parameter that would be great!

Leon

4

1 回答 1

0

我们一直在努力解决同样的问题,谷歌的文档非常无助,因为他们自己关于 storeCode 的示例不起作用。

实际上似乎起作用的是通过 location_name/locationName 过滤并在您的商店代码中轻弹(不要问我为什么,当然这没有任何意义)。

因此,您必须像这样调用 API:

GET
https://mybusiness.googlapis.com/v4/accounts/xxxx/locations?filter=location_name="RT-1"

GET
https://mybusiness.googlapis.com/v4/accounts/xxxx/locations?filter=locationName="RT-1"

如果您使用 upperCamelCase 似乎没有任何区别。

最好的问候,马克

于 2020-09-25T14:24:14.973 回答