> For the complete documentation index, see [llms.txt](https://landofcoder.gitbook.io/magento-2-step-recommendation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://landofcoder.gitbook.io/magento-2-step-recommendation/rest-api.md).

# REST API

![List REST API](/files/-MgxRWzXlOz9DdrlIYmE)

## Get Recommendation Result

<mark style="color:green;">`POST`</mark> `https://yourdomain.com/rest/v1/lof-steprecommendation/result`

This endpoint allows you to get recommendation result with answers and rule, can access by anonymous

#### Query Parameters

| Name      | Type    | Description                                          |
| --------- | ------- | ---------------------------------------------------- |
| store\_id | integer | current store id                                     |
| rule\_id  | integer | The step recommendation rule\_id                     |
| answers   | string  | list answer index of rule questions example: "1,2,2" |

{% tabs %}
{% tab title="200 Result successfully retrieved." %}

```
{
  "category_id": 0,
  "products": [
    {
      "product_id": 3,
      "sku": "24-MB03",
      "price": 38,
      "description": "short description crawn summit backpack...",
      "name": "Crown Summit Backpack",
      "image": "/m/b/mb03-black-0.jpg",
      "item_url": "https://yourdomain.com/crown-summit-backpack.html?___store=default"
    },
    {
      "product_id": 4,
      "sku": "24-MB05",
      "price": 45,
      "description": "short description wayfarer",
      "name": "Wayfarer Messenger Bag",
      "image": "/m/b/mb05-black-0.jpg",
      "item_url": "https://yourdomain/wayfarer-messenger-bag.html?___store=default"
    }
  ],
  "thumb_width": 100,
  "thumb_height": 100,
  "show_image": 1,
  "show_price": 1,
  "show_description": 1,
  "show_sku": 1,
  "show_review": 1,
  "show_addtocart": 1,
  "sort_max": 100,
  "description": "",
  "name": "",
  "image": "",
  "item_url": "",
  "query_link": "",
  "cms_block_id": ""
}
```

{% endtab %}

{% tab title="404 Unexpected error" %}

```
{
  "message": "string",
  "errors": [
    {
      "message": "string",
      "parameters": [
        {
          "resources": "string",
          "fieldName": "string",
          "fieldValue": "string"
        }
      ]
    }
  ],
  "code": 0,
  "parameters": [
    {
      "resources": "string",
      "fieldName": "string",
      "fieldValue": "string"
    }
  ],
  "trace": "string"
}
```

{% endtab %}
{% endtabs %}
