product-reviews

product-reviews.find

Returns the product reviews that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.product-reviews.find', request, function(response) { … });
HTTP POST
/api/v6/commerce.product-reviews.find
{
  "conditions" : { // returns only the reviews …
    "code" : "NS1208", // … with this code - string(1…32)
    "product" : 281, // … of this product (id) - int(1…)
    "language" : "en", // … in this language (ISO code) - string(2)
    "after" : "NS1208" // … with code after this value - string(0…32)  },
  "fields" : [ "code", "product", … ], // fields to return - string
  "order" : [ "date" ], // sort order of returned reviews, can contain "code", "-code", "date", "-date", "rating" and "-rating" - string
  "limit" : 10, // maximum number of reviews to return - int(1…)
  "first" : 0 // index of the first review to return - int(0…)
}

Response

{
  "status" : "ok",
  "reviews" : [ {
    "code" : "NS1208", // code - string(1…32)
    "product" : 281, // product (id) - int(1…)
    "date" : "2013-09-01 12:39:07", // date - datetime
    "author" : "Bob", // author name - string(0…60)
    "language" : "en", // language (ISO code) - string(2)
    "rating" : 4.5, // rating - decimal[2,1](0…5)
    "summary" : "Excellent product", // summary - string(0…255)
    "content" : "…" // content - string(0…64000)
  }, … ]
}

product-reviews.count

Number of product reviews that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.product-reviews.count', request, function(response) { … });
HTTP POST
/api/v6/commerce.product-reviews.count
{
  "conditions" : { // counts only the reviews …
    "code" : "NS1208", // … with this code - string(1…32)
    "product" : 281, // … of this product (id) - int(1…)
    "language" : "en", // … in this language (ISO code) - string(2)
    "after" : "NS1208" // … with code after this value - string(0…32)  }
}

Response

{
  "status" : "ok",
  "count" : 23 // number of reviews - int(0…)
}

product-reviews.create

Creates a product review or, if a review with the same code already exists, updates the existing review.

Request

Admin SDK
Admin.api('commerce.product-reviews.create', request, function(response) { … });
HTTP POST
/api/v6/commerce.product-reviews.create
{
  "review" : { // product review to create (required)
    "code" : "NS1208", // code (required) - string(1…32)
    "product" : 281, // product (id) (required) - int(1…)
    "date" : "2013-09-01 12:39:07", // date - datetime
    "author" : "Bob", // author name - string(0…60)
    "language" : "en", // language (ISO code) (required) - string(2)
    "rating" : 4.5, // rating - decimal[2,1](0…5)
    "summary" : "Excellent product", // summary - string(0…255)
    "content" : "…" // content (required) - string(0…64000)
  }
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
product NotFound Product <product> does not exist

product-reviews.delete

Deletes one or more reviews.

Request

Admin SDK
Admin.api('commerce.product-reviews.delete', request, function(response) { … });
HTTP POST
/api/v6/commerce.product-reviews.delete
{
  "codes" : [ "NS1208", "PQ7209", … ] // codes of the reviews to delete (required) - string(1…32)
}

Response

{
  "status" : "ok"
}
`