product-reviews

product-reviews.find

Returns the product reviews that meet the given conditions.

JS
CR.api('commerce.product-reviews.find', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.product-reviews.find

request

{
  "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)
  },
  "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…100)
  "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.

JS
CR.api('commerce.product-reviews.count', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.product-reviews.count

request

{
  "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)
  }
}

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.

JS
CR.api('commerce.product-reviews.create', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.product-reviews.create

request

{
  "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.

JS
CR.api('commerce.product-reviews.delete', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.product-reviews.delete

request

{
  "codes" : [ "NS1208", "PQ7209", … ] // codes of the reviews to delete (required) - string(1…32)
}

response

{
  "status" : "ok"
}