Skip to content

Powered by Grav CMS + Helios Theme

Reviews

The moderation queue for customer reviews, and the rating rebuild.

The moderation queue. No route writes or edits a review, and none will. See Reviews and ratings.

List product reviews

GET /api/v1/kahunacart/reviews Permission kahunacart.products.manage

List product reviews for moderation, oldest first, optionally narrowed to one state or one product. Each carries its rating, its text, whether it is a verified purchase, and who moderated it. Omit state to see the whole history rather than only what is waiting.

Parameters

Name Type Description
state optional string Only reviews in this state; omit for all of them.
One of: pending, approved, rejected
product_id optional integer Only reviews of this product.
page optional integer At least 1.
per_page optional integer At least 1, at most 100.
sort optional string A column to sort every row by before it is paged; leave out for the usual order
One of: rating, review, product, author, written, state
dir optional string
One of: asc, desc
Default: asc
q optional string Words to search for in the review's title and words, the author's name and email, and the product's title; every word has to be there, in any order. Applied before the sort and the page, and total counts what it found

Approve a review

POST /api/v1/kahunacart/reviews/{id}/approve Permission kahunacart.products.manage

Publish a review on its product page and count it in that product's star rating. The verified-purchase badge is recomputed at this moment, so a review written before an offline payment cleared earns the badge when it goes live. The badge can never be set by hand.

Parameters

Name Type Description
id required integer The review to publish.

Reject a review

POST /api/v1/kahunacart/reviews/{id}/reject Permission kahunacart.products.manage

Turn a review down. The row is kept with a timestamp and the name of whoever rejected it, so a merchant asked six months later why a review is not on the site has an answer. Use delete_review for spam.

Parameters

Name Type Description
id required integer The review to turn down.

Delete a review

DELETE /api/v1/kahunacart/reviews/{id} Permission kahunacart.products.manage

Remove a review outright, leaving no record of it. For spam. A review a merchant only disagrees with should be rejected instead, which keeps the audit trail.

Parameters

Name Type Description
id required integer The review to delete.

Rebuild the star ratings

POST /api/v1/kahunacart/reviews/rebuild Permission kahunacart.products.manage

Throw away every cached star aggregate in the store so the next request recomputes it. The ratings already expire on their own and every moderation decision refreshes them, so this is for a store whose numbers look wrong after a database was edited by hand.

The verified-purchase badge is computed from the writer's own paid orders and recomputed on approval. No request body can set it.