Retrieve the reviews payload in HTML

Definition

https://staticw2.yotpo.com/batch

Body

Parameter

Type

Description

app_key

string

Your Yotpo account API key

methods[method]

string

An array of widget types (methods) and an hash of the parameters for each method

methods[params]

object

The specific parameters for the method

is_mobile

boolean false

Defines 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. :point-down:

<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

Methods

Parameters

Batch Result

main_widget

pid - 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

bottomline

pid - 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

testimonials

data-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

embedded

per_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

badge

None ("params" : {})

The Yotpo badge

questions_bottomline

pid- The product SKU for which to bring the questions and answers

A summary of the number of questions and answers per product

Example

POST https://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 an 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.