如何解决参数名称必须符合模式^ accounts / [^ /] + / locations / [^ /] + $?

时间:2019-02-09 04:48:10

标签: java android google-my-business-api

我正在尝试处理GMB API,但无法获取我的位置数据,因为它给位置名称带来了错误 Location Link.

我一直在寻找解决此错误的方法,但找不到任何有用的方法。

private static Location getLocationByName(String locationName) throws IOException {
    MyBusiness.Accounts.Locations.Get location =
            mybusiness.accounts().locations().get(locationName);

    Location response = location.execute();
    return response;
}
getLocationByName("Jandran+karyana+and+General+store");
//call to method in main()

它应该返回位置,但会抛出该错误。 这是logcat。

     Exception in thread "main" java.lang.IllegalArgumentException: Parameter name must conform to the pattern ^accounts/[^/]+/locations/[^/]+$
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:141)
    at com.google.api.client.util.Preconditions.checkArgument(Preconditions.java:49)
    at com.google.api.services.mybusiness.v4.MyBusiness$Accounts$Locations$Get.<init>(MyBusiness.java:3569)
    at com.google.api.services.mybusiness.v4.MyBusiness$Accounts$Locations.get(MyBusiness.java:3540)
    at app.jamshaid.parking.Main.getLocationByName(Main.java:168)
    at app.jamshaid.parking.Main.main(Main.java:97)

Process finished with exit code 1

0 个答案:

没有答案