Class: ReviewAPI
Review API client for managing product reviews. Provides comprehensive methods to retrieve, filter, and analyze reviews.
Constructors
Constructor
new ReviewAPI(http: HttpClient, apiKey: string): ReviewAPI;Parameters
http
HttpClient
apiKey
string
Returns
ReviewAPI
Methods
getAllReviewsBasic()
getAllReviewsBasic(params?: {
count?: string;
customerId?: string;
customQuestions?: string;
deleted?: string;
fromDate?: string;
fromId?: string;
group?: string;
groupName?: string;
label?: string;
likes?: string;
page?: string;
postType?: string;
productId?: string;
questionEnable?: string;
questionPublic?: string;
reviewType?: string;
sort?: string;
sortOrder?: string;
stars?: string;
starsSorting?: string;
updatedDate?: string;
}): Promise<ReviewResponse>;Retrieves all reviews with extensive filtering and pagination options.
Parameters
params?
Optional query parameters for filtering and pagination
count?
string
Number of reviews per page
customerId?
string
Filter reviews by customer ID
customQuestions?
string
Include custom questions ('1' or '0')
deleted?
string
Include deleted reviews ('1' or '0')
fromDate?
string
Filter reviews from this date (YYYY-MM-DD format)
fromId?
string
Filter reviews from this review ID
group?
string
Filter by group
groupName?
string
Filter by group name
label?
string
Filter by label
likes?
string
Filter by likes count
page?
string
Page number
postType?
string
Filter by post type
productId?
string
Filter by product ID
questionEnable?
string
Filter by question enabled status ('1' or '0')
questionPublic?
string
Filter by question public status ('1' or '0')
reviewType?
string
Filter by review type
sort?
string
Sort field (e.g., 'date', 'score')
sortOrder?
string
Sort order ('asc' or 'desc')
stars?
string
Filter by star rating
starsSorting?
string
Star sorting method
updatedDate?
string
Filter reviews updated from this date
Returns
Promise<ReviewResponse>
Promise resolving to review response with reviews array
Throws
When the API returns an error
Throws
When a network error occurs
getBatchLikeCounts()
getBatchLikeCounts(
reviewIds: string[],
userIdentifier?: string,
options?: {
widgetType?: ReviewWidgetType;
}): Promise<ReviewBatchLikeData>;Retrieves like (and optionally dislike) counts for up to 100 reviews in a single request. Recommended for list views — inspect any entry with isDislikeEnabled to decide whether to render the dislike UI.
Parameters
reviewIds
string[]
userIdentifier?
string
options?
widgetType?
Returns
Promise<ReviewBatchLikeData>
Example
const likes = await sdk.reviews().getBatchLikeCounts(
['review-1', 'review-2'],
'cust_abc123',
{ widgetType: 'widget' }
);
const dislikeEnabled = likes.length > 0 && isDislikeEnabled(likes[0]);getCustomersReviewSummary()
getCustomersReviewSummary(customerIds: string[], filter?: ReviewSummaryFilter): Promise<CustomerReviewSummary>;Retrieves an aggregated review summary across one or more customers. Returns a single summary object covering the supplied IDs.
Parameters
customerIds
string[]
Customer IDs to aggregate
filter?
Optional filter for summary calculation
Returns
Promise<CustomerReviewSummary>
Promise resolving to the aggregated customer review summary
Throws
When the API returns an error
Throws
When a network error occurs
getFilteredReviewSummary()
getFilteredReviewSummary(reviewType: ReviewSummaryType, filter: ReviewSummaryFilter): Promise<ReviewSummary>;Retrieves filtered review summary based on review type and filter criteria.
Parameters
reviewType
The type of review to filter by
filter
Filter criteria for summary calculation
Returns
Promise<ReviewSummary>
Promise resolving to filtered review summary
Throws
When the API returns an error
Throws
When a network error occurs
getGroupsReviewSummary()
getGroupsReviewSummary(groupIds: string[], filter?: ReviewSummaryFilter): Promise<ReviewSummary>;Retrieves aggregated review summary statistics for multiple groups.
Parameters
groupIds
string[]
Array of group IDs to get summary for
filter?
Optional filter for summary calculation
Returns
Promise<ReviewSummary>
Promise resolving to review summary with aggregated statistics
Throws
When the API returns an error
Throws
When a network error occurs
getLikeCount()
getLikeCount(
reviewId: string,
userIdentifier?: string,
options?: {
widgetType?: ReviewWidgetType;
}): Promise<ReviewLikeData>;Retrieves the like (and optionally dislike) count for a review and whether the current user/IP has voted. Use isDislikeEnabled to check whether dislike fields are present (i.e. whether to render dislike UI).
Parameters
reviewId
string
userIdentifier?
string
options?
widgetType?
Returns
Promise<ReviewLikeData>
Example
const likes = await sdk.reviews().getLikeCount('review-123', 'cust_abc123', {
widgetType: 'widget',
});
if (isDislikeEnabled(likes)) {
console.log(likes.dislike_count);
}getReview()
getReview(reviewId: string): Promise<Review>;Retrieves a single review by its ID.
Parameters
reviewId
string
The ID of the review to retrieve
Returns
Promise<Review>
Promise resolving to the review
Throws
When the API returns an error or review not found
Throws
When a network error occurs
getReviewFormFields()
getReviewFormFields(productId: string, options?: {
orderId?: string;
}): Promise<ReviewFormFieldsData>;(V1 API) Returns form field configuration, validation rules, product info, and labels needed to render a review form.
Parameters
productId
string
Product identifier
options?
orderId?
string
Optional order context. Inspect the returned form_config and fields to determine which reviewer fields should be rendered and required.
Returns
Promise<ReviewFormFieldsData>
Promise resolving to form fields data (product, form_config, fields, labels)
Throws
When the API returns an error
Throws
When a network error occurs
Example
const formData = await sdk.reviews().getReviewFormFields('product-123');
const fromOrder = await sdk.reviews().getReviewFormFields('product-123', {
orderId: 'order-456',
});
console.log(formData.form_config?.submit_button_text);getReviewSummary()
getReviewSummary(reviewType: ReviewSummaryType, params?: {
aiSummary?: boolean;
group?: string;
groupName?: string;
productId?: string;
qnaSummary?: boolean;
ratingBreakdown?: boolean;
}): Promise<ReviewSummary>;Retrieves review summary statistics for a specific review type.
Optional payload extensions:
aiSummary→ai_summary=1: include the AI-generated summary block (ReviewSummary.ai_summary).qnaSummary→q_n_a_summary=1: include per-question aggregates (ReviewSummary.q_n_a_summary).ratingBreakdown→rating_breakdown=1: include the 1..5 star counts (ReviewSummary.rating_breakdown).
Parameters
reviewType
'site' | 'product' | 'all'
params?
Optional filters and payload flags
aiSummary?
boolean
group?
string
groupName?
string
productId?
string
qnaSummary?
boolean
ratingBreakdown?
boolean
Returns
Promise<ReviewSummary>
Promise resolving to review summary
Throws
When the API returns an error
Throws
When a network error occurs
getReviewsWithOrders()
getReviewsWithOrders(params?: ReviewFilterParams): Promise<ReviewWithOrders[]>;Retrieves reviews along with their associated order information. Useful for analyzing purchase behavior and review patterns.
Parameters
params?
Optional filter parameters for reviews
Returns
Promise<ReviewWithOrders[]>
Promise resolving to an array of reviews with order data
Throws
When the API returns an error
Throws
When a network error occurs
submitReviewV1()
submitReviewV1(params: ReviewSubmitV1Request): Promise<
| {
message?: string;
verification_email_sent?: boolean;
}
| undefined>;(V1 API) Submits a new review. The reviewer receives a verification email to confirm their submission.
Parameters
params
Submit review params (product_id, score, review, email, order_id, etc.)
Returns
Promise< | { message?: string; verification_email_sent?: boolean; } | undefined>
Promise resolving to success data (verification_email_sent, message)
Throws
When status is "field_error" (see UKomiFieldValidationException.fieldErrors)
Throws
When a duplicate submission is rejected (HTTP 409)
Throws
On other API errors (e.g. invalid API key)
Throws
When a network error occurs
Example
const result = await sdk.reviews().submitReviewV1({
product_id: 'product-123',
score: 5,
review: 'Great product!',
title: 'Love it',
email: 'user@example.com',
name: 'John',
});
// Order flow (refer to review_form_fields for required reviewer fields):
await sdk.reviews().submitReviewV1({
product_id: 'product-123',
order_id: 'order-456',
score: 5,
review: 'Great!',
title: 'Love it',
});
console.log(result?.message);toggleLike()
toggleLike(
reviewId: string,
userIdentifier?: string,
options?: {
vote?: LikeVote;
widgetType?: ReviewWidgetType;
}): Promise<ReviewLikeData>;Toggles a like or dislike on a review. Same-direction vote toggles off, opposite direction flips in one operation.
Parameters
reviewId
string
userIdentifier?
string
Optional caller-provided identifier.
options?
vote?
widgetType?
Selects the widget context for this vote.
Returns
Promise<ReviewLikeData>
Throws
When vote='down' is not permitted in the given widget context
Throws
When the per-user rate limit is exceeded
Example
await sdk.reviews().toggleLike('review-123', 'cust_abc123');
await sdk.reviews().toggleLike('review-123', 'cust_abc123', {
vote: 'down',
widgetType: 'dedicated-widget',
});