0

I'm trying to read additional items after reading the first 20 items of the result set using explore method in the H.service.PlacesServices (Maps API v3.1) namespace

I am only able to read the first the first 20 items OK, but receive an unauthorised result when I call the follow(uri) method as suggested passing the URI.

Code written in Angular / TypeScript. I also tried including an apikey as well as app_id & code. However, I would assume that since I am using the same initialised Object, the appkey is passed with the follow(uri) method automatically.

I also tried using httpClient but I get a similiar error.

I would assume that calling the next page doesn't require any authentication.

this.platform = new H.service.Platform({apikey: "xxx"});
this.places = this.platform.getPlacesService();

var query = {"at":  lat +"," + lng +";r=1000,"cat" : categories +",pretty"};

await this.places.explore(query, async (result) => {
    values = result;

    ***do something***  

    await this.places.follow(result.results.next, (result2) => {

    ***do something*** 

    }, (e) => {console.log(e)});    
}, (e) => {console.log(e)});

What am I doing wrong?? Any suggestions, please?

I'd love reading the next items but I receive a 401 not authorised error

GET https://places.ls.hereapi.com/places/v1/discover/explore;context=Y2F0PXBldHJvbC1zdGF0aW9uJTJDcHJldHR5JmZsb3ctaWQ9YzBiYTRjYjMtZTFkZi01MTQ0LTkxZjMtYWE5NzczMmI2YTFkXzE1NzMxNTU5NzkxMTZfMF8yODQyJm9mZnNldD0yMCZzaXplPTIw?at=53.78%2C7.7 401 (Unauthorized)

{"error":"Unauthorized","error_description":"Bearer token invalid. Bearer missing or bearer value missing."}

1 Answer 1

0

Please read carefully, how to use the follow method, the method is used to follow hyperlinks in the results returned by discovery queries.

var places = platform.getPlacesService(), entryPoint = H.service.PlacesService.EntryPoint; places.request(entryPoint.SEARCH, {'at': '52.5044,13.3909', 'q': 'pizza'}, function(response) { var items = response.results.items; places.follow(items[0].href, function(resp) { console.log(resp); }, function(resp) { console.log('ERROR: '+resp); }); }, function(resp) { console.log('ERROR: '+resp); });

Sign up to request clarification or add additional context in comments.

1 Comment

HI, thanks for this. It works receiving the first twenty items. Unfortunately, there's no option to receive next results of that query any longer. What can we do receiving more items in the result set=

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.