Retrieve the Reviews Payload in HTML

Definition

http://staticw2.yotpo.com/batch

Body

ParameterTypeDescription
app_keystringYour Yotpo account API key
methods[method]stringAn array of widget types (methods) and an hash of the parameters for each method
methods[params]objectThe specific parameters for the method
is_mobileboolean falseDefines if the response should be for a mobile device or a desktop

👍

Reviews Widget

In order for the Reviews Widget to appear on product pages, be sure to add the HTML below to your product page template. Replace each data element with the appropriate values of your website and product attributes. Note that the data-product-id attribute only supports alphanumeric (a...z, A...Z, 0...9) and "_" and "-" symbols. 👇

<div class="yotpo yotpo-main-widget"
data-product-id="SKU/Product_ID"
data-price="Product Price"
data-currency="Price Currency"
data-name="Product Title"
data-url="The url to the page where the product is (url escaped)"
data-image-url="The product image url. Url escaped">
</div>

Batch Payload Types

MethodsParametersBatch Result
main_widgetpid - The product SKU for which to bring the main reviews widget.


page (optional) -
The page number of the reviews page as applied by the Reviews Widget.
The current reviews page will be passed as a query param called yoReviewsPage
Full HTML of a reviews widget which belongs to a specific product
bottomlinepid - The product SKU for which to bring the bottom line widget.

skip_average_score - Boolean value to show or hide the average score in the bottom line.

format - The format to return the result
HTML (default)
JSON
Star rating widget that belongs to the same specific product
testimonialsdata-product-readonly - A flag to enable or disable the ability to write new reviews (false if not specified)Reviews tab that opens the site and product reviews pop-up
embeddedper_page - Number of reviews per page

view - Customizations for the embedded widget. Refer to your Yotpo Admin page as well.
type
layout
width
headerText
transparency
headerBackgroundColor
bodyBackgroundColor
fontSize
fontColor
Embedded widget
badgeNone ("params" : {})The Yotpo badge
questions_bottomlinepid- The product SKU for which to bring the questions and answersA summary of the number of questions and answers per product

Example

POST http://staticw2.yotpo.com/batch?
{
  "methods": [{
      "method":"main_widget",
      "params": {
        "pid": "334342199",
         "page":"2"
       }
  },
{
  "method":"bottomline",
      "params": {
        "pid": "334342199"
       },
  "format": "json"
  }
],
"app_key":"YOUR_APP_KEY"
  },
{
  "methods": [{
      "method":"testimonials",
      "params":{"type":"testimonials","pid":"11643860358"}
  }
],
"app_key":"YOUR_APP_KEY",
"is_mobile":"false"
}

Result Format

[
	{
		"method":"main_widget",
		"result":"<div class="yotpo-display-wrapper yotpo-no-reviews" style="visibility: hidden;">    <div class="yotpo-label yotpo-small-box "> ....... // HTML is cut for brevity"},
	{	"method":"bottomline",
	"result":"<span class="yotpo-display-wrapper" style="visibility: hidden;">  <div class="standalone-bottomline"> .... // HTML is cut for brevity"
	}
]

The methods parameter is an array of methods. Each method is a hash containing the method and parameters, which is a hash of the parameters for the method.

📘

Please note:

Include the empty params attribute - "params" : {} - for the badge method.

📘

Please note:

The pid parameter is mandatory.
The pid parameter cannot contain the "/" symbol.

👍

Tip:

It is highly recommended to develop a cache mechanism to save the payload locally and to refresh it periodically. The purpose of this caching is to avoid long loading times every time the widget loads.