最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - How can I get Hours of Operations using AWS Location Services? - Stack Overflow

programmeradmin4浏览0评论

I am attempting to retrieve the places information based on the code samples however, I am not able to get the hours of operation. The demo web app in AWS shows this as a value that is useable.

This is what I am trying:

    // Build the search text from parameters
    String searchText = String.format("%s %s %s %s", name, addressLine1, city, state);

    // Create search request
    SearchPlaceIndexForTextRequest searchRequest = SearchPlaceIndexForTextRequest.builder()
            .indexName(placesIndex)
            .text(searchText)
            .build();

    // Execute search
    SearchPlaceIndexForTextResponse searchResponse = locationClient.searchPlaceIndexForText(searchRequest);

    if (searchResponse.hasResults() && !searchResponse.results().isEmpty()) {
        // Get the first result's place ID
        Optional<SearchForTextResult> results = searchResponse.results().stream().findFirst();

        String placeId = results.get().placeId();

        logger.debug("place id: {}", placeId);

        // Create get place request
        GetPlaceRequest placeRequest = GetPlaceRequest.builder()
                .placeId(placeId)
                .indexName(placesIndex)
                .language("en")  // Specify language for the response
                .build(); 
   }

However I never get hours back, for example on a McDonalds I get the following:

{"businessHours":"{\"addressNumber\":\"510\",\"categories\":[\"PointOfInterestType\"],\"country\":\"USA\",\"geometry\":{\"point\":[-116.2429,43.60939]},\"interpolated\":false,\"label\":\"McDonald\\u0027s, 510 N Orchard St, Boise, ID 83706-1979, United States\",\"municipality\":\"Boise\",\"neighborhood\":\"Morris Hill\",\"postalCode\":\"83706-1979\",\"region\":\"Idaho\",\"street\":\"N Orchard St\",\"subRegion\":\"Ada\",\"supplementalCategories\":[\"Fast Food\"],\"timeZone\":{\"name\":\"America/Boise\",\"offset\":-25200}}"}

But the sample app shows:

Can this API return the hours noted?

发布评论

评论列表(0)

  1. 暂无评论