Open2b versione 7.5

reviews

reviews.find

Returns the reviews that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.reviews.find', request, function(response) { … });
HTTP POST
/api/v10/commerce.reviews.find
{
  "conditions" : { // returns only the reviews …
    "code" : "NS1208", // … with this code - string(1…32)
    "type" : "Product", // … of this type, can be "Merchant" or "Product" - string
    "products" : [ 281, 290, … ], // … of these products (id) (can be null) - int(1…)
    "language" : "en", // … in this language (ISO code) - string(2)
    "after" : "NS1208" // … with code after this value - string(0…32)
  },
  "fields" : [ "code", "type", "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)
    "type" : "Product", // type, can be "Merchant" or "Product" - string
    "product" : 281, // product (id) (can be null) - int(1…)
    "date" : "2020-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)
  }, … ]
}

Errors

Field Type Description
products InvalidValue products must be null if type is "Merchant"

reviews.count

Number of reviews that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.reviews.count', request, function(response) { … });
HTTP POST
/api/v10/commerce.reviews.count
{
  "conditions" : { // counts only the reviews …
    "code" : "NS1208", // … with this code - string(1…32)
    "type" : "Product", // … of this type, can be "Merchant" or "Product" - string
    "products" : [ 281, 290, … ], // … of these products (id) (can be null) - 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" : 23075 // number of reviews - int(0…)
}

Errors

Field Type Description
products InvalidValue products must be null if type is "Merchant"

reviews.create

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

Request

Admin SDK
Admin.api('commerce.reviews.create', request, function(response) { … });
HTTP POST
/api/v10/commerce.reviews.create
{
  "review" : { // product review to create (required)
    "code" : "NS1208", // code (required) - string(1…32)
    "type" : "Product", // type, can be "Merchant" or "Product" (required) - string
    "product" : 281, // product (id) (can be null) - int(1…)
    "date" : "2020-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 InvalidValue product must be null if type is "Merchant"
product Missing product is required if type is "Product"
product NotFound Product <product> does not exist

reviews.delete

Deletes one or more reviews.

Request

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

Response

{
  "status" : "ok"
}