HERE Places API: not all items have PVID
Asked Answered
J

2

8

I'm using HERE Places API.

Firstly I'm doing a search.

For Example this query :

https://places.cit.api.here.com/places/v1/discover/search?q=Test&at=35.6111,-97.5467&r=500&size=1&app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg&show_refs=pvid&pretty

According to this documentation (Link) If I add show_refs=pvid to query string, in result I will get external id which I can use to query lookup endpoint.

But in result I get next response :

    {
    "results": {
        "next": "https://places.cit.api.here.com/places/v1/discover/search;context=Zmxvdy1pZD1hY2ExNzk3NC0zYzg3LTU5NzQtYmZkMC04YjAzMDZlYWIzMWJfMTUwNjA3NjMzMTYyMl83NDY3XzM4NTAmb2Zmc2V0PTEmc2l6ZT0x?at=35.6111%2C-97.5467&q=Test&app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg",
        "items": [
            {
                "position": [
                    35.60369,
                    -97.51761
                ],
                "distance": 2756,
                "title": "Southwest Test & Balance",
                "averageRating": 0,
                "category": {
                    "id": "business-services",
                    "title": "Business & Services",
                    "href": "https://places.cit.api.here.com/places/v1/categories/places/business-services?app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg",
                    "type": "urn:nlp-types:category",
                    "system": "places"
                },
                "icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/02.icon",
                "vicinity": "200 NW 132nd St<br/>Oklahoma City, OK 73114",
                "having": [],
                "type": "urn:nlp-types:place",
                "href": "https://places.cit.api.here.com/places/v1/places/8403fv6k-d1b2fde0616e0326e321a54b88cd9f53;context=Zmxvdy1pZD1hY2ExNzk3NC0zYzg3LTU5NzQtYmZkMC04YjAzMDZlYWIzMWJfMTUwNjA3NjMzMTYyMl83NDY3XzM4NTAmcmFuaz0w?app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg",
                "id": "8403fv6k-d1b2fde0616e0326e321a54b88cd9f53",
                "authoritative": true
            }
        ]
    },
    "search": {
        "context": {
            "location": {
                "position": [
                    35.6111,
                    -97.5467
                ],
                "address": {
                    "text": "Oklahoma City, OK 73134<br/>USA",
                    "postalCode": "73134",
                    "city": "Oklahoma City",
                    "county": "Oklahoma",
                    "stateCode": "OK",
                    "country": "United States",
                    "countryCode": "USA"
                }
            },
            "type": "urn:nlp-types:place",
            "href": "https://places.cit.api.here.com/places/v1/places/loc-dmVyc2lvbj0xO3RpdGxlPU9rbGFob21hK0NpdHk7bGF0PTM1LjYxMTE7bG9uPS05Ny41NDY3O2NpdHk9T2tsYWhvbWErQ2l0eTtwb3N0YWxDb2RlPTczMTM0O2NvdW50cnk9VVNBO3N0YXRlQ29kZT1PSztjb3VudHk9T2tsYWhvbWE7Y2F0ZWdvcnlJZD1jaXR5LXRvd24tdmlsbGFnZTtzb3VyY2VTeXN0ZW09aW50ZXJuYWw;context=c2VhcmNoQ29udGV4dD0x?app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg"
        }
    }
}

In response no object references

Is it a bug or not every place has this external id?

Janae answered 22/9, 2017 at 11:25 Comment(0)
H
1

I am responding as member of the team around HERE Places API.

Yes, not every place has a pvid. That is why I would suggest using the Sharing Id instead. I realize that the documentation should be improved to clarify that.

The Sharing Ids can be obtained by adding show_refs=sharing to either your search query or a place details request. It can be found in the field references. Once you have the sharing id you can you the lookup endpoint as you intended.

Hispid answered 10/10, 2017 at 21:4 Comment(4)
Thanks for reply. Well, I have tried that request and search is fine, but I can't get how details request is working with sharing id... Before I have done request to lookup endpoint, but now you are showing example like /places/v1/places/{sharingId}. And it isn't working if I don't have context. Could you give me a link how correctly build details request. ThanksJanae
Maybe the confusion caused by the 302 redirect returned by the lookup endpoint which most browser will automatically follow. That's why you see the /places/v1/places in the URL bar even though you fired a lookup-request by following my link. So you can do this in your application: places.cit.api.here.com/places/v1/places/lookup?source=sharing&id=omitted and you will be redirected (HTTP 302) to resolved place details.Hispid
Yeah, thanks, now it is better :) Btw, I can get details about place just using placeId (not sharing id) just need include &source=sharing to query string. Is it also correct?Janae
I would more rely on the sharing-id lookup. As it contains more information, it designed to survive id drifts in the place ids.Hispid
S
0

Take a look at:

https://places.cit.api.here.com/places/v1/places/8403fv6k-d1b2fde0616e0326e321a54b88cd9f53;context=Zmxvdy1pZD00YWU2ZWZjNi01ZjgzLTUwYTQtOTI4OS0xZjliMGMwNWY3NjBfMTUwNzA0NDE0OTc3NV84MTI5XzU1NDcmcmFuaz0w?app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg&show_refs=pvid

and

https://places.cit.api.here.com/places/v1/places/8409q8yy-6af3c3e50bcb4f859686797b2be5773d;context=Zmxvdy1pZD00YWU2ZWZjNi01ZjgzLTUwYTQtOTI4OS0xZjliMGMwNWY3NjBfMTUwNzA0NDE0OTc3NV84MTI5XzU1NDcmcmFuaz0w?app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg&show_refs=pvid

On those two examples, the only difference is the placeId.

In the docs, there's not a single reference saying that the external identifier is required or existant for every place.

Since it represents an external identifier, I believe we could assume that it's not required.

And it's what we just saw with your place (8403fv6k-d1b2fde0616e0326e321a54b88cd9f53): this one don't have any external identifier.


Based on your comments, what you need is the information about a place.

So, after you run your first query, you should get something like:

{
    title: "Southwest Test & Balance",
    position: [],
    id: "8403fv6k-d1b2fde0616e0326e321a54b88cd9f53",
    href: "https://[...]"
}

With this ID, you could access it:

places.cit.api.here.com/places/v1/places/8403fv6k-d1b2fde0616e0326e321a54b88cd9f53;context=Zmxvdy1pZD0zYTFlZjg5ZS02ZTY5LTUxYmEtYWFkYS1kY2UwZWMyNDdkMDBfMTUwNzEzNjUxNjI5N182NjExXzc2OTgmcmFuaz0w?app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg

Or directly using the href information.

This response already is giving you the ID and URL to access all the info of a single place.
You don't need any other external ID or reference.

Sophey answered 3/10, 2017 at 16:0 Comment(9)
does this means that endpoint /places/lookup also marked as "Additional" can't be "executed" to every place?Janae
As stated in the docs (developer.here.com/documentation/places/topics_api/…), the lookup find a place by its foreign ID. So, I believe the best answer for your question would be: no, you can't lookup every place. You can try the lookup here: places.cit.api.here.com/places/v1/places/…Sophey
Is there any id which always exists that I can use with lookup endpoint?Janae
This specific endpoint uses foreign IDs, which is not guaranteed to exist for every place. What's your real problem? Lookup places by a specific ID?Sophey
I need to receive detailed information about some place. Lookup endpoint looks fine for me in this case... but it only works with foreign Ids...Janae
@Janae And how do you define "some place"? Do you have an ID in your system? It's a latitude/longitude reference? It's by name/address? First you need to define clearly how you identify two different places. After that, with this information, then you would need to ask a new question: "How do I lookup a place based on X information?".Sophey
As I mentioned in question - firstly I do search (https://places.cit.api.here.com/places/v1/discover/search?q=Test&at=35.6111,-97.5467&r=500&size=1&app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg&show_refs=pvid&pretty) . Results I try to match by placeName and coordinates based on data that I have in db (also name + coordinates). After this I can get 0 or 1 item. And for this item I want to get all information that I can using lookup endpoint (seems like the most detailed endpoint). Well that's allJanae
I understood your question was "Is it a bug or not every place has this external id?" so I answered that. based on your last comment I added the information to access the details about a specific place. I hope it's what you need. If so, please adjust your question accordingly to better explain what you really need.Sophey
Let us continue this discussion in chat.Janae

© 2022 - 2024 — McMap. All rights reserved.