v1

latestOpenAPI 3.0.22026-08-0426137631.3 KB
Q&A APIs

Question Autocomplete API

Question Autocomplete is an important feature for Q&A applications. It not only saves your users from typing the complete questions, but also showcases what questions your app is capable answering. This is important because Q&A is an advanced search feature that not every user is familar with.

Miso generates autocomplete candidates from the question bank you uploaded (see Question Bank Upload API). Given a partial question string, Question Autocomplete API will suggest question candidates that match the query the user is typing.

For example, let's first upload three questions to the question bank:

POST /v1/qa/questions
{"data": [
    {"question": "What is python?"},
    {"question": "What is pypy?"},
    {"question": "How to sort a list in Python?"}
]}

Then, immediately after the above request finished, you can send the request below to get autocompletion candidates for any partial query string. For example, if the query string the user types so far is "what is p":

POST /v1/qa/question_autocomplete
{
    "q": "what is p",
    "rows": 5
}

The API will respond the completion candidates like the following:

{
    "data":
        "completions": [
            {"question": "What is python?"},
            {"question": "What is pypy?"}
        ]
    }
}

The API supports adaptive fuzzy matching such that even if there are typos in the query string, the API is still able to return the question candidates with the correct spellings. For example, if the query string is "How to sorta". The API is still able to match the completion candidate: "How to sort a list in Python?"

The API is optimized for instant experience and has an average response time lower than 50ms.

post/v1/qa/question_autocomplete

Request body

qstring required

The query user has entered so far

rowsinteger

Number of autocomplete results to return.

Example request

{
  "q": "what is g"
}

Response

Successful Response

messagestring

Example response

{
  "data": {
    "miso_id": "123e4567-e89b-12d3-a456-426614174000"
  }
}