Automatic Related Products API Guide

Automatic Related Products API

Info
We have created a public API collection for Automatic Related Products module with all available queries and sample data that you can both test via our demo endpoints and copy to run local tests in your Magento environment. More details about using public collections can be found in the following FAQ post.
1. Amasty\Mostviewed\Api\GroupRepositoryInterface - class for managing related product rules.
  1. POST /V1/amasty_mostviewed/rules", method="save" - create a rule;
  2. PUT /V1/amasty_mostviewed/rules/:groupId, method="save" - edit a rule;
  3. DELETE /V1/amasty_mostviewed/rules/:groupId", method="deleteById" - delete a rule by its ID;
  4. GET /V1/amasty_mostviewed/rules/:groupId", method="getById" - get a rule by its ID;
  5. GET /V1/amasty_mostviewed/rules", method="getList" - get a list of rules.

2. Amasty\Mostviewed\Api\ProductGroupResolverInterface - class for managing rules for product pages.
  1. GET /V1/amasty_mostviewed/rules/product-group-by-id", method="getGroupByProductIdAndPosition" - get a group for product pages by product ID and position;
  2. GET /V1/amasty_mostviewed/rules/product-group-by-sku", method="getGroupByProductSkuAndPosition" - get a group for product pages by product and position

3. Amasty\Mostviewed\Api\CategoryGroupResolverInterface - class for managing rules for category pages.
  1. GET /V1/amasty_mostviewed/rules/category-group", method="getGroupByCategoryIdAndPosition - get a group for category pages by category ID and position.

4. Amasty\Mostviewed\Api\CartGroupResolverInterface - class for managing rules for shopping cart pages.
  1. GET /V1/amasty_mostviewed/rules/guest-cart-group/:maskedCartId", method="getGroupByMaskedQuoteIdAndPosition" - get a group for shopping cart pages by positiob for not logged-in customers;
  2. GET /V1/amasty_mostviewed/rules/cart-group", method="getGroupByQuoteIdAndPosition" - get a group for shopping cart pages.

5. Amasty\Mostviewed\Api\CustomGroupResolverInterface - class for managing rules with custom positions (for example, CMS pages).
  1. GET /V1/amasty_mostviewed/rules/custom-group", method="getGroup"- get a group with custom position by its ID;
  2. GET /V1/amasty_mostviewed/rules/custom-group-for-product", method="getGroupForProduct" - get a group with custom position by product ID;
  3. GET /V1/amasty_mostviewed/rules/custom-group-for-guest-cart/:maskedCartId", method="getGroupForGuestCart" - get a group with custom position for not logged-in user shopping cart page;
  4. GET /V1/amasty_mostviewed/rules/custom-group-for-customer-cart", method="getGroupForCart" - get a group with custom position for users on shopping cart page.