Get product reviews
curl --request GET \
--url {protocol}://{host}/wp-json/cocart/v2/products/reviewsimport requests
url = "{protocol}://{host}/wp-json/cocart/v2/products/reviews"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('{protocol}://{host}/wp-json/cocart/v2/products/reviews', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "{protocol}://{host}/wp-json/cocart/v2/products/reviews",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{protocol}://{host}/wp-json/cocart/v2/products/reviews"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("{protocol}://{host}/wp-json/cocart/v2/products/reviews")
.asString();require 'uri'
require 'net/http'
url = URI("{protocol}://{host}/wp-json/cocart/v2/products/reviews")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body[
{
"id": 567,
"date_created": "2024-09-15T14:30:22",
"date_created_gmt": "2024-09-15T18:30:22",
"product_id": 145,
"status": "approved",
"reviewer": "Sarah Johnson",
"reviewer_email": "sarah.j@example.com",
"review": "These headphones are absolutely fantastic! The sound quality is crystal clear and the noise cancellation works incredibly well. Battery life is even better than advertised. Highly recommend for anyone looking for premium wireless headphones.",
"rating": 5,
"verified": true
},
{
"id": 589,
"date_created": "2024-09-18T09:15:45",
"date_created_gmt": "2024-09-18T13:15:45",
"product_id": 145,
"status": "approved",
"reviewer": "Mike Chen",
"reviewer_email": "m.chen@example.com",
"review": "Great headphones overall. Sound quality is excellent and very comfortable to wear for long periods. Only minor issue is they're a bit bulky for travel, but that's expected with over-ear headphones. Still giving 5 stars!",
"rating": 5,
"verified": true
},
{
"id": 612,
"date_created": "2024-09-22T16:42:10",
"date_created_gmt": "2024-09-22T20:42:10",
"product_id": 278,
"status": "approved",
"reviewer": "Emma Wilson",
"reviewer_email": "emma.w@example.com",
"review": "Love this t-shirt! The cotton is so soft and the fit is perfect. Washes well and doesn't shrink. I've already ordered it in three more colors.",
"rating": 5,
"verified": true
}
]{
"code": "cocart_invalid_parameter",
"message": "Invalid parameter provided.",
"data": {
"status": 400
}
}Get Product Reviews
Gets a list of product reviews.
GET
/
products
/
reviews
Get product reviews
curl --request GET \
--url {protocol}://{host}/wp-json/cocart/v2/products/reviewsimport requests
url = "{protocol}://{host}/wp-json/cocart/v2/products/reviews"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('{protocol}://{host}/wp-json/cocart/v2/products/reviews', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "{protocol}://{host}/wp-json/cocart/v2/products/reviews",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{protocol}://{host}/wp-json/cocart/v2/products/reviews"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("{protocol}://{host}/wp-json/cocart/v2/products/reviews")
.asString();require 'uri'
require 'net/http'
url = URI("{protocol}://{host}/wp-json/cocart/v2/products/reviews")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body[
{
"id": 567,
"date_created": "2024-09-15T14:30:22",
"date_created_gmt": "2024-09-15T18:30:22",
"product_id": 145,
"status": "approved",
"reviewer": "Sarah Johnson",
"reviewer_email": "sarah.j@example.com",
"review": "These headphones are absolutely fantastic! The sound quality is crystal clear and the noise cancellation works incredibly well. Battery life is even better than advertised. Highly recommend for anyone looking for premium wireless headphones.",
"rating": 5,
"verified": true
},
{
"id": 589,
"date_created": "2024-09-18T09:15:45",
"date_created_gmt": "2024-09-18T13:15:45",
"product_id": 145,
"status": "approved",
"reviewer": "Mike Chen",
"reviewer_email": "m.chen@example.com",
"review": "Great headphones overall. Sound quality is excellent and very comfortable to wear for long periods. Only minor issue is they're a bit bulky for travel, but that's expected with over-ear headphones. Still giving 5 stars!",
"rating": 5,
"verified": true
},
{
"id": 612,
"date_created": "2024-09-22T16:42:10",
"date_created_gmt": "2024-09-22T20:42:10",
"product_id": 278,
"status": "approved",
"reviewer": "Emma Wilson",
"reviewer_email": "emma.w@example.com",
"review": "Love this t-shirt! The cotton is so soft and the fit is perfect. Washes well and doesn't shrink. I've already ordered it in three more colors.",
"rating": 5,
"verified": true
}
]{
"code": "cocart_invalid_parameter",
"message": "Invalid parameter provided.",
"data": {
"status": 400
}
}Query Parameters
Current page of the collection.
Maximum number of items to return per page.
Limit results to those matching a search string.
Limit results to reviews for specific products.
Response
Product reviews retrieved successfully.
Unique identifier for the resource.
The date the review was created.
The date the review was created, as GMT.
Unique identifier for the product that the review belongs to.
Status of the review.
Name of the reviewer.
Email of the reviewer.
The content of the review.
Review rating (0 to 5).
Shows if the reviewer bought the product or not.