Search and Recommendation API reference and data model

The Search and Recommendation API for Sitecore Search enables developers to query content and receive personalized recommendations. This topic explains where to find the official API reference and provides an overview of the required data model for requests.

Important

Refer to the API reference for the data object to be post all available objects

The following code block displays a sample API request and lists some common objects.

RequestResponse
{
  "context": {
    "ids": {
      "property1": [
        "string"
      ],
      "property2": [
        "string"
      ]
    },
    "locale": {
      "country": "us",
      "language": "en"
    },
    "page": {
      "uri": "string"
    },
    "user": {
      "uuid": "string" //or "user_id": "string" if your uuid does not follow the example here (https://doc.sitecore.com/search/en/developers/search-developer-guide/using-a-uuid-to-track-site-visitors.html)
    }
  },
  "widget": {
    "items": [
      {
        "entity": "string",
        "rfk_flags": [
          "+semsearch"
        ],
        "rfk_id": "string",
        "search": {
          "content": {
            "fields": [
              "name",
              "price"
            ]
          },
          "facet": {
            "all": true,
            "max": 10,
            "sort": {
              "name": "text",
              "order": "asc"
            },
            "types": [
              {
                "after": "facetid_123",
                "exclude": [
                  "val1",
                  "val2"
                ],
                "filter": {
                  "type": "or",
                  "values": [
                    "facetid_123",
                    "facetid_123"
                  ]
                },
                "filtering_options": [
                  "hard_filters",
                  "other_facet_values"
                ],
                "keyphrase": "Sitecore",
                "max": 10,
                "min_count": 1,
                "name": "brands",
                "sort": {
                  "name": "text",
                  "order": "asc"
                }
              }
            ]
          },
          "filter": {
            "type": "string"
          },
          "group_by": "group_id",
          "limit": 10,
          "offset": 0,
          "personalization": {
            "algorithm": "hard_filters",
            "fields": [
              "brand",
              "color"
            ],
            "ids": [
              "id1",
              "id2"
            ]
          },
          "query": {
            "highlight": {
              "post_tag": "</em>",
              "pre_tag": "<em>"
            },
            "keyphrase": "Sitecore",
            "operator": "or",
            "relevance": [
              {
                "analyzer": "rfk_standard",
                "name": "color",
                "weight": 1
              }
            ]
          },
          "ranking": [
            {
              "name": "sales",
              "weight": 1
            }
          ],
          "related_questions": {
            "highlight": {
              "post_tag": "</em>",
              "pre_tag": "<em>"
            },
            "max": 10
          },
          "rule": {
            "behaviors": true,
            "blacklist": {
              "filter": {
                "type": "string"
              }
            },
            "boost": [
              {
                "filter": {
                  "type": "string"
                },
                "slots": [
                  1,
                  5
                ]
              }
            ],
            "bury": {
              "filter": {
                "type": "string"
              }
            },
            "include": [
              {
                "filter": {
                  "type": "string"
                },
                "slots": [
                  1,
                  5
                ]
              }
            ],
            "pin": [
              {
                "id": "id1",
                "slot": 1
              }
            ]
          },
          "sort": {
            "choices": true,
            "value": [
              {
                "name": "color",
                "order": "desc"
              }
            ]
          },
          "suggestion": [
            {
              "max": 2,
              "name": "my_suggester"
            }
          ],
          "swatch": {
            "fields": [
              "name",
              "price"
            ],
            "group_by": "group_id",
            "max": 10
          }
        },
        "sources": [
          "sourceID1",
          "sourceID2"
        ]
      }
    ]
  }
}

Do you have some feedback for us?

If you have suggestions for improving this article,