如何使用 java 获取 mybusinessbusinessinformation.googleapis 中指定位置的 google 更新版本

how to get google-updated version of the specified location in mybusinessbusinessinformation.googleapis using java

假设 mybusiness 是 MyBusinessBusinessInformation 类型的初始值设定项,它也负责凭证,而 locationName 是一个字符串,它指的是特定位置,其格式为 locations/XXXXXXX。 I am using this link

   try {

         MyBusinessBusinessInformation.Locations.GetGoogleUpdated updateList=mybusiness.locations().getGoogleUpdated(locationName);                     
           GoogleUpdatedLocation response = updateList.execute();
          if(response!=null && !response.isEmpty()) {
                               System.out.println(response.toString());
                           }
   }catch(Exception e){
     System.out.println(e);
   }

错误是

com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request

提前致谢。

感谢@Vprienser,我发现 read_mask 是必须的。

String readMask="storeCode,regularHours,name,languageCode,title,phoneNumbers,categories,storefrontAddress,websiteUri,regularHours,specialHours,serviceArea,labels,adWordsLocationExtensions,latlng,openInfo,metadata,profile,relationshipData,moreHours";

   try { 
        MyBusinessBusinessInformation.Locations.GetGoogleUpdated updateList=mybusiness.locations()
                                   .getGoogleUpdated(locationName).setReadMask(readMask);
                                
         GoogleUpdatedLocation response = updateList.execute();
                           
        if(response!=null && !response.isEmpty()) {
               System.out.println(response.toString());
           }
   }catch (Exceptions e){
    System.out.println(e);
   }