Retrieving Reviews

The use of the placeholder {access_token} is in reference to the JWT token you get back when you authenticate against the eTrusted servers. Visit the Setup and Authentication section of the docs to learn how to generate one if you haven't already.

What are reviews?

Reviews are the answers customers provide to a questionnaire together with metadata to provide context. All reviews collected from customers are made available within the control center for viewing, however, sometimes you will like to do more with these reviews. For example, carry out further analysis or simply displaying them on your website.

Whatever be the use case the reviews API is a good starting point if you need to access the reviews programmatically.

How to retrieve customer reviews

Here is an example of what an API call in CURL will look like:

curl --location --request GET 'https://api.etrusted.com/reviews' \
--header 'Authorization: Bearer {access_token}'

The above shows a very simple request without filters. There are many filters you can pass in as query parameters to narrow down to specific reviews.

For example, get reviews under a particular Channel, reviews with specific ratings, etc.
To see the full list of query parameters check out the reviews API documentation.

You should get back a response similar to the following on a successful request:

{
    "totalElements": 1,
    "paging": {
        "count": 1,
        "cursor": {
            "before": "rev-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx",
            "after": "rev-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx"
        },
        "links": {
            "previous": "https://api.etrusted.com/channels/{channelId}/customer-reviews?count=1&before=rev-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx",
            "next": "https://api.etrusted.com/channels/{channelId}/customer-reviews?count=1&after=rev-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx"
        }
    },
    "items": [
        {
            "_object": "CustomerReview",
            "id": "rev-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx",
            "accountRef": "acc-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx",
            "channelRef": "chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx",
            "rating": 4.0,
            "title": "Great experience",
            "comment": "Everything went well. Very helpful staff!",
            "createdAt": "2018-02-01T17:09:41.790Z",
            "updatedAt": "2018-02-01T17:09:41.790Z",
            "submittedAt": "2018-02-01T17:09:41.790Z",
            "state": "DRAFT",
            "type": "SERVICE_REVIEW",
            "inviteRef": "inv-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx",
            "customer": {
                "fullName": "John Doe",
                "email": "[email protected]",
                "mobile": "+123456789"
            },
            "transaction": {
                "reference": "ORDER-12792",
                "date": "2018-01-04T12:09:50.722Z"
            },
            "event": {
                "id": "evt-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx",
                "type": "checkout"
            },
            "questionnaire": {
                "id": "qre-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx",
                "locale": "de_DE",
                "templateRef": "qrt-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx"
            }
        }
    ]
}

What next?

Over time the list of reviews grows, and it's no longer feasible to send all of it to you at once when you make an API request.

eTrusted handles this by providing pagination, it will be reasonable to implement this as part of your application in time for that growth. Visit the pagination docs to learn how eTrusted handles paginations.

There is a lot more you can do with the APIs we didn't touch, to learn more you can visit the API Documentation to do so.