# 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://landofcoder.gitbook.io/magento-2-step-recommendation/rest-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
