Overview
CSV Feed
PHP SDK
API Integration
API For Partners
Feedback summary
This method can be applied on your server-side, in order to get the number of approved feedback entries and their average score, for example to display “4.9/5 from 1234 reviews” on your website.
To get the feedback entries themselves (scores, comments and product reviews), use the Feedback method.
Method: GET
URL: https://api.retargeting.app/v1/email-campaigns/json-feedback/summary
| Field | Type | Required | Description |
|---|---|---|---|
| k | number or text | True | The REST API Key can be found into your account Settings -> Integration -> REST API Key, second field. |
| u | text | True | Your customer ID can be found in your account Settings -> Integration -> Customer ID, third field |
Your account status must be in one of the states: PAID, PAYMENT ERROR or ACCOUNT SUSPENDED.
If your account is Inactive or Closed the API call will not work.
The API call will respond with JSON format.
Recommendations
- Call the API only from your server. Your REST API Key must never be exposed in the JavaScript code that runs in the browser.
- Cache the results (for example for 1 hour) instead of calling the API on every page view.
Example
<?php require_once "vendor/autoload.php"; $apiURL = "https://api.retargeting.app/v1/email-campaigns/json-feedback/summary"; $apiKey = "REST_KEY"; $customerId = "CUSTOMER_ID"; $client = new GuzzleHttp\Client(); $summaryData = [ "k" => $apiKey, "u" => $customerId ]; $summaryRequest = $client->request("GET", $apiURL, ["query" => $summaryData]);
If the API call succeeds, then the response will be as seen below:
{
"total_reviews": 1234,
"average_score": 9.8,
"average_score_5": 4.9,
"scale_max": 10
}
If there is no approved feedback yet:
{
"total_reviews": 0,
"average_score": null,
"average_score_5": null,
"scale_max": 10
}
Response fields
| Field | Type | Description |
|---|---|---|
| total_reviews | int | Number of approved feedback entries. |
| average_score | number or null | Average score on the 1–10 scale, with 2 decimals. null when there is no approved feedback. |
| average_score_5 | number or null | The same average converted to a 5-point scale (average_score / 2), with 2 decimals. Use it for displays like “4.9/5 from 1234 reviews”. null when there is no approved feedback. |
| scale_max | int | Always 10 (the native score scale). |
total_reviews counts all the approved feedback, including the entries whose order was deleted, which the Feedback method skips. That is why it can be slightly higher than the number of entries returned by the full feedback list.
If the API call fails, the response will be returned with the HTTP status 200 and "status": "error", as seen below:
When the customer id parameter is not provided:
{
"status": "error",
"error": "No customer id provided!"
}
When the rest key parameter is not provided:
{
"status": "error",
"error": "No rest key provided!"
}
When the rest key parameter is invalid:
{
"status": "error",
"error": "Incorrect rest key!"
}
When the customer id parameter is invalid:
{
"status": "error",
"error": "No customer found with the provided id!"
}
When the account is not active:
{
"status": "error",
"error": "Your account is not active!"
}
Unexpected server errors are returned with the HTTP status 500 and a generic response, not in the format above.