Go To Top

How to get all your service reviews

A guide to getting all your service reviews through the Trustpilot API

get_all_service_reviews.jpg

Introduction

This guide will walk you through the different API endpoints you can use to reply to a service review.

While the API examples provided are valid, they contain “dummy data” and {{placeholders}}. Remember to fill in the correct values for the placeholders.

We recommend that you follow and read the documentation (links) in this guide to get a better  understanding of the API endpoints and how they work.

Before you start

Integration guidelines

If you’re planning to use Trustpilot data to display on your website you should start by reading our integration guidelines. The guidelines will tell you how to implement content and display the Trustpilot logo and images correctly.

Authentication

To use the API endpoints described in this guide you will need an API key, and to authenticate. Once you’ve authenticated you should have an access_token that you can use to authorize the different API calls.

How to get your service reviews

To get a list of your service reviews you can call the “Get a business unit’s reviews” endpoint.

For our example, let’s say we want all english reviews. We’d use the endpoint like this:
https://api.trustpilot.com/v1/business-units/{{business-unit-id}}/reviews?language=en
here’s the URL for doing just that with the Trustpilot.com business unit:

https://api.trustpilot.com/v1/business-units/46d6a890000064000500e0c3/reviews?language=en

Example of a response:

{
 
"links": [
    {
      "href": "https://api.trustpilot.com/v1/business-units/46d6a890000064000500e0c3/reviews?language=en&page=2",
      "method": "GET",
      "rel": "next-page"
    },
    {
      "href": "https://api.trustpilot.com/v1/business-units/46d6a890000064000500e0c3",
      "method": "GET",
      "rel": "business-units"
    }
   ]
,
 
"reviews": [
   {
     
"links": [ ... ],
     
"id": "999283910000ff00098a9265",
     
"consumer": {
       
"links": [ ... ],
       
"id": "999de5ed000064000127bc3c",
       
"displayName": "Jane Doe",
       
"displayLocation": "New York",
       
"numberOfReviews": 8
     },
     
"businessUnit": {
       
"links": [ ... ],
       
"id": "9996a890000064000500e0c3",
       
"identifyingName": "www.trustpilot.com",
       
"displayName": "Trustpilot"
     },
     
"stars": 5,
     
"title": "Excellent resource",
     
"text": "Always worth checking Trustpilot before making a purchase. Can't fault the service.",
     
"language": "en",
     
"createdAt": "2016-09-21T12:56:49Z",
     
"updatedAt": null,
     
"companyReply": {
       
"text": "Hi Jane,\n\nThank you for your 5 star review!",
       
"createdAt": "2016-09-21T13:23:11.073Z"
     },
     
"isVerified": true,
     
"numberOfLikes": 4,
     
"status": "active",
     
"reportData": null
   }, ...
 ]
}

As you can see in the result, using the “reviews” key we have a list of reviews. The reviews each have information about the consumer, the business unit, how many stars were given, title of the review, text of the review and a company reply (if available).

Get more service reviews

The above example will only get us the first 20 reviews. If we want more than that, we can use the “perPage” parameter and expand this number up to 100. If we need even more we’ll need to call the endpoint several times with the “page” parameter.

Lucky for you this is really easy. If you look at the result above there’s a “links” property. The “links” property holds a list of links objects.

Each link object contains a relevant link for the returned response. Notice the “next-page” link? As long as there are more service reviews than shown in the response, the link objects tell you where to find the “next” and/or “previous” page.

Get all service reviews

So one approach to getting all service reviews would be to call this endpoint repeatedly, saving the reviews locally, until there is no longer a “next-page” in the links property.