Enrich a product page with Tripadvisor reviews

  • Resort content
  • 1 route
How do I retrieve Tripadvisor ratings, awards, and reviews for a product?

The goal of this use case is to retrieve all the information we're interested in from Tripadvisor: ratings, awards, and reviews. This data is displayed on Club Med® product pages to showcase them.

GET ​/vX​/products​/{product_id}​/tripadvisor

Location_id

"location_id": "152890"

This is the Tripadvisor location ID.

Tripadvisor_url

"tripadvisor_url": "https://www.tripadvisor.fr/Hotel_Review-g150807-d152890-Reviews-Club_Med_Cancun-Cancun_Yucatan_Peninsula.html?m=24206"

URL leading to the product page on Tripadvisor. This link is displayed on the Club Med website so that the user can be redirected to Tripadvisor and see all the desired information in detail.

Rating

"rating": "4.5"

Overall product rating.

Rating_image_url

"rating_image_url": "https://www.tripadvisor.fr/img/cdsi/img2/ratings/traveler/4.5-24206-5.svg"

This is the overall rating image used to display the rating with the small circles.

Subratings

"subratings": [
  {
    "rating_image_url": "https://static.tacdn.com/img2/ratings/traveler/ss4.5.svg",
    "name": "rate_location",
    "value": "4.5",
    "localized_name": "Emplacement"
  }
]

Here are all the ratings by category:

  • Emplacement,
  • Literie,
  • Chambres,
  • Service,
  • Rapport qualité / prix,
  • Propreté.

For each category, we find:

  • the image corresponding to the rating as before,
  • a label,
  • the rating,
  • the category name.

This allows you to detail the overall rating.

Awards

"awards": [
  {
    "award_type": "GreenLeader",
    "year": "",
    "images": {
      "small": "https://www.tripadvisor.fr/img/cdsi/img2/awards/greenleader_new_green_small-24206-5.png",
      "large": "https://www.tripadvisor.fr/img/cdsi/img2/awards/greenleaders/GreenLeaders_API_fr_large_partner-24206-5.jpg"
    },
    "categories": [
      "GreenPartner"
    ],
    "display_name": "GreenLeader Partner"
  },
  {
    "award_type": "Travelers Choice",
    "year": "2021",
    "images": {
      "small": "https://www.tripadvisor.fr/img/cdsi/img2/awards/CERTIFICATE_OF_EXCELLENCE_v2_small-24206-5.jpg",
      "large": "https://www.tripadvisor.fr/img/cdsi/img2/awards/CERTIFICATE_OF_EXCELLENCE_2021_ROW_large-24206-5.jpg"
    },
    "categories": [],
    "display_name": "Travelers Choice 2021"
  }
]

Here are the awards won. To learn more about the Travelers Choice award and the GreenLeader Parter award

Reviews

"reviews": [
  {
    "id": "828179613",
    "lang": "fr",
    "location_id": "152890",
    "published_date": "2022-02-15T23:40:15-0500",
    "rating": 5,
    "helpful_votes": "0",
    "rating_image_url": "https://www.tripadvisor.fr/img/cdsi/img2/ratings/traveler/s5.0-24206-5.svg",
    "url": "https://www.tripadvisor.fr/ShowUserReviews-g150807-d152890-r828179613-Club_Med_Cancun-Cancun_Yucatan_Peninsula.html?m=24206#review828179613",
    "trip_type": "En famille",
    "travel_date": "2022-02",
    "text": "Nous avons passé un très bon séjour du 7 au 14 février \nLes soirées étaient un peu fraîches à cause du vent mais sinon, nous avons eu du soleil toute la semaine.\nLe club est divisé en 2 parties avec des voiturettes qui tournent toutes les 5min pour vous transporter d’un bout à l’autre. Il y a 2 piscines et 2 espaces différents donc les GM sont bien dispersés…\nTrès belles excursions et pas trop chères \nLa nourriture est variée et bonne \nNous retournerons dans ce club avec grand plaisir !",
    "user": {
      "username": "Adamedia67",
      "user_location": {
        "name": "Strasbourg",
        "id": null
      },
      "review_count": "24",
      "reviewer_badge": "Auteur confirmé"
    },
    "title": "Très beau club avec de belles prestations",
    "owner_response": null,
    "subratings": [
      {
        "rating_image_url": "https://www.tripadvisor.fr/img/cdsi/img2/ratings/traveler/s5.0-24206-5.svg",
        "name": "rate_room",
        "value": "5",
        "localized_name": "Chambres"
      },
      {
        "rating_image_url": "https://www.tripadvisor.fr/img/cdsi/img2/ratings/traveler/s4.0-24206-5.svg",
        "name": "rate_value",
        "value": "4",
        "localized_name": "Rapport qualité / prix"
      },
      {
        "rating_image_url": "https://www.tripadvisor.fr/img/cdsi/img2/ratings/traveler/s4.0-24206-5.svg",
        "name": "rate_sleep",
        "value": "4",
        "localized_name": "Literie"
      },
      {
        "rating_image_url": "https://www.tripadvisor.fr/img/cdsi/img2/ratings/traveler/s5.0-24206-5.svg",
        "name": "rate_location",
        "value": "5",
        "localized_name": "Emplacement"
      },
      {
        "rating_image_url": "https://www.tripadvisor.fr/img/cdsi/img2/ratings/traveler/s5.0-24206-5.svg",
        "name": "rate_cleanliness",
        "value": "5",
        "localized_name": "Propreté"
      },
      {
        "rating_image_url": "https://www.tripadvisor.fr/img/cdsi/img2/ratings/traveler/s4.0-24206-5.svg",
        "name": "rate_service",
        "value": "4",
        "localized_name": "Service"
      }
    ]
  }
]

It appears that these are the last 4 published comments. The Club Med website only displays comments with ratings of 5.

Num_reviews

"num_reviews": "12355"

Total number of votes on this product.

1

Retrieve Tripadvisor reviews

Optional

Use GET/v0/products/{product_id}/tripadvisor to retrieve the review signals attached to a product, including rating, trophies, and comments.

Prerequisites

Prepare product_id. Keep x-api-key and, when the route is customer-scoped, a valid bearer token.

Calling CURL

curl -X GET \
  -H "x-api-key: YOUR_API_KEY" \
  -H "accept-language: en-US" \
  "https://api.clubmed.com/v0/products/{product_id}/tripadvisor"

Example answer

{
  "rating": 4.5,
  "trophies": [
    "Travelers' Choice"
  ],
  "comments": [
    {
      "author": "Alice",
      "title": "Great stay",
      "rating": 5
    }
  ]
}

info: Use the rating, trophies, and sample comments together when enriching a product page or a Tripadvisor block.


Response codes

  • 200 OK: the expected data is returned.
  • 400 Bad Request: the request is invalid or incomplete.
  • 404 Not Found: the requested resource cannot be found.
GET/v0/products/{product_id}/tripadvisor
See more