Retrieve JSON
Retrieve a list of product reviews in JSON format.
GET /1.0/product_reviews.json
Query parameters
They should be passed as query parameters to the URL. (ex.: ?id=1&code=abc
)
id
int (required)
The unique webshop ID.
code
string (required)
Your personal API code.
public_code
string (required)
* Use instead of code
in case you want to fetch data with JavaScript
offset
int
Get only reviews after the given offset. (e.g. you have 15 results, with offset 10 you will get the last 5)
limit
int
Limit the number of results you receive. (e.g. you have 100 reviews, with limit 50, you will see 50 of your 100 reviews)
Example response
{
"total": 1,
"product_reviews": [
{
"id": 1,
"reviewer": {
"name": "John Doe",
"email": "example@email.com"
},
"rating": 5,
"review": "Example review text",
"product_id": "1",
"language": "nl",
"deleted": false,
"created": "2022-03-11 09:13:50"
}
]
}
Example code
<?php
$id = 1;
$code = '123456789abc123456789';
$offset = 10;
$limit = 10;
$curl = curl_init(
sprintf(
'https://dashboard.trustprofile.com/api/1.0/product_reviews.json?id=%s&code=%s&offset=%s&limit=%s',
$id,
$code,
$offset,
$limit,
),
);
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
]);
$response = curl_exec($curl);
if ($response !== false) {
$data = json_decode($response, true);
} else {
// An error occurred
}