Skip to content

Retrieve XML

Retrieve a list of product reviews in XML format.

GET /1.0/product_reviews.xml

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

detailed boolean

Get extra information about product reviews. Helpful for syncing product reviews back to website.

last_synced string

Get only reviews after given date (Y-m-d H:i:s).

Example response

<feed xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="http://www.google.com/shopping/reviews/schema/product/2.3/product_reviews.xsd">
    <version>2.3</version>
    <aggregator>
        <name>Trustprofile</name>
    </aggregator>
    <publisher>
        <name>Example shop</name>
        <favicon>https://example.com/image.png</favicon>
    </publisher>
    <reviews>
        <review>
            <review_id>12345789</review_id>
            <reviewer>
                <name>John Doe</name>
            </reviewer>
            <review_timestamp>2020-11-16T15:37:54+01:00</review_timestamp>
            <content>Example review text</content>
            <review_url type="singleton">https://www.trustprofile.com/reviews/view/123456789</review_url>
            <ratings>
                <overall min="1" max="5">5</overall>
            </ratings>
            <products>
                <product>
                    <product_ids>
                        <gtins>
                            <gtin>12345678</gtin>
                        </gtins>
                        <skus>
                            <sku>SKU12345678</sku>
                        </skus>
                    </product_ids>
                    <product_name>Example product name</product_name>
                    <product_url>https://example.com/product</product_url>
                    <external_id>e12345678</external_id>
                </product>
            </products>
            <is_spam>false</is_spam>
            <email>example@email.com</email>
            <valid>1</valid>
            <deleted/>
            <modified>2020-11-17T15:37:54+01:00</modified>
        </review>
    </reviews>
</feed>

Example code

<?php

$id = 1;
$code = '123456789abc123456789';
$detailed = 1;
$last_synced = '2022-06-07 17:00:00';

$curl = curl_init(
    sprintf(
        'https://dashboard.trustprofile.com/api/1.0/product_reviews.xml?id=%s&code=%s&detailed=%s&last_synced=%s',
        $id,
        $code,
        $detailed,
        $last_synced,
    ),
);

curl_setopt_array($curl, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
]);

$response = curl_exec($curl);

if ($response !== false) {
    $data = simplexml_load_string($response);
} else {
    // An error occurred
}