CDub
CDub

Reputation: 13354

JSON Results - Storing ID and/or Reference

I'm trying to build a simple reviews site for a very specific search parameter, which I can pull information back from Google Places API. I understand I cannot store any information other than what Google says I can, and it sounds like I can only store the "reference" parameter and the "id" parameter.

Upon creation of a review for a place returned from Google, I need to store some identifier so that when someone else searches Google Places through my site, I can do an AJAX call to my DB and pull all reviews for that Place.

Ultimately, my question is, which key should I store? Or both?

Upvotes: 1

Views: 1483

Answers (2)

paul_c
paul_c

Reputation: 56

As of June 24, 2014 the id and reference fields are deprecated. placeId (for requests) and place_id (in responses) should be used instead.

The Places API currently returns a place_id in all responses, and accepts a placeid in the Place Details and Place Delete requests. Soon after June 24, 2015, the API will stop returning the id and reference fields in responses. Some time later, the API will no longer accept the reference in requests. We recommend that you update your code to use the new place ID instead of id and reference as soon as possible.

Upvotes: 3

Chris Green
Chris Green

Reputation: 4427

As per the documentation:

id contains a unique stable identifier denoting this place. This identifier may not be used to retrieve information about this place, but is guaranteed to be valid across sessions. It can be used to consolidate data about this Place, and to verify the identity of a Place across separate searches.

reference contains a unique token that you can use to retrieve additional information about this place in a Place Details request. You can store this token and use it at any time in future to refresh cached data about this Place, but the same token is not guaranteed to be returned for any given Place across different searches.

It would make sense to store both, reference to retrieve reviews from Google Places and id to group your place reviews in your db.

Upvotes: 7

Related Questions