My Business
1.8K members online now
1.8K members online now
For developers who are using the Google My Business API to manage locations
Guide Me
star_border
Reply

Does every field in Review object in Java API really have the possibility of being null?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

If you look in the Java API documentation you see every getter annotated with comments stating that the field can be null:

  /**
   * The encrypted unique identifier.
   * @return value or {@code null} for none
   */
  public java.lang.String getReviewId() {
    return reviewId;
  }

Having the reviewId be null seems very strange, and no mention of this is made in the HTTP api reference. Are these autogenerated comments or should the information be taken seriously that the API will return reviews that have the possibility of having any field be null?

1 Expert replyverified_user

Re: Does every field in Review object in Java API really have the possibility of being null?

Google Employee
# 2
Google Employee

Hi @Dermot H,

 

The getReviewId() method in the Java client library that gets the reviewId of the Review object for a specified location is only valid if the location is verified. If the specified location is unverified, the review does not exist, or the review has been deleted, it returns the null value.

 

So please make sure that the isVerified boolean field of the LocationState object in the specified location is true since any review operation is only valid if the location is verified.

 

Thanks,

Shalini

Re: Does every field in Review object in Java API really have the possibility of being null?

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Thanks a lot, Shalini.