# Integrated API

## Find Match

<mark style="color:green;">`POST`</mark> `https://backend.alli.ai/webapi/find_match`

This API is for integrated search for fuzzy match, small talk, q\&a.

#### Headers

| Name                                      | Type   | Description                                                                                        |
| ----------------------------------------- | ------ | -------------------------------------------------------------------------------------------------- |
| API-KEY<mark style="color:red;">\*</mark> | string | Your cognitive search API key can be found in your dashboard Settings menu, under the General tab. |

#### Request Body

| Name                                     | Type    | Description                                                                                                  |
| ---------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------ |
| process\_order                           | array   | can be list of "exact\_match", "small\_talk", "faq", "mrc", default: \["exact\_match", "small\_talk", "faq"] |
| exact\_match\_list                       | array   | exact match list when using "exact\_match"                                                                   |
| exact\_match\_threshold                  | number  | default: 0.85                                                                                                |
| small\_talk\_threshold                   | number  | default: 0.85                                                                                                |
| faq\_threshold                           | number  | default:0. 90                                                                                                |
| faq\_direct\_answer\_mdethod             | string  | can be "adaptive", "simple". default: "adaptive"                                                             |
| faq\_direct\_answer\_adaptive\_thrdshold | number  | default: 0.4                                                                                                 |
| faq\_direct\_answer\_direct\_threshold   | string  | default: 0.9                                                                                                 |
| faq\_hashtags                            | array   | faq filtering hashtags                                                                                       |
| faq\_hashtags\_operator                  | string  | can be "and", "or", default: "or"                                                                            |
| faq\_count                               | number  | default: 5                                                                                                   |
| faq\_format                              | string  | can be "draftjs", "html", "text". default: "text"                                                            |
| mrc\_threshold                           | number  | default: 0.80                                                                                                |
| mrc\_hashtags                            | array   | mrc filtering hashtags                                                                                       |
| mrc\_hashtags\_operator                  | string  | can be "and", "or", default: "or"                                                                            |
| mrc\_count                               | string  | default: "5"                                                                                                 |
| mrc\_format                              | string  | can be "text", "html". default: "text"                                                                       |
| mrc\_return\_po                          | boolean | default: False                                                                                               |
| faq\_excluding\_hashtags                 | array   | faq filter-out hashtags                                                                                      |
| faq\_excluding\_hashtags\_operator       | string  | can be "and", "or", default: "or"                                                                            |

{% tabs %}
{% tab title="200 Successfully retrieved.
found: true/false
process: matching process name
error: error message

When process = exact\_match
result: exact match keyword

When process = faq
result\[].id: Q\&A id
result\[].question: Q\&A question
result\[].answer: Q\&A answer
" %}

```
{
  "found": true, 
  "result": [
    {
      "confidence": 0.8660902048311576, 
      "effectiveConfidence": 0.8660902048311576, 
      "question": "QA 게이트(GATE)", 
      "answer": "...", 
      "id": "RkFROjYwZDA3MGU5NWRjZDlkZTliMzFlNTI5MA==", 
      "lastUpdatedDate": "2021-06-21", 
      "createdDate": "2021-06-21", 
      "hashtags": ["실무용어"], 
      "userFeedback": {"positiveCount": 0, "negativeCount": 0}, 
      "agentFeedback": {"positiveCount": 0, "negativeCount": 0}
    }
  ], 
  "process": "faq", 
  "error": null
}
```

{% endtab %}
{% endtabs %}

### Request Example

Please replace YOUR API KEY with your one in example below, To get the api key, please see [getting-api-key](https://docs.allganize.ai/api_documentation/#getting-api-key) section.

```
$ curl -H "API-KEY: YOUR_API_KEY" \
       -d'{"process_order":["exact_match", "small_talk", "faq"], \
           "exact_match_list": ["aaaa", "bbbb"], \
           "query": "QA", \
           "faq_threshold": 0.85}' \
       "https://backend.alli.ai/webapi/find_match"
{
  "found": true, 
  "result": [
    {
      "confidence": 0.8660902048311576, 
      "effectiveConfidence": 0.8660902048311576, 
      "question": "QA 게이트(GATE)", 
      "answer": "...", 
      "id": "RkFROjYwZDA3MGU5NWRjZDlkZTliMzFlNTI5MA==", 
      "lastUpdatedDate": "2021-06-21", 
      "createdDate": "2021-06-21", 
      "hashtags": ["실무용어"], 
      "userFeedback": {"positiveCount": 0, "negativeCount": 0}, 
      "agentFeedback": {"positiveCount": 0, "negativeCount": 0}
    }
  ], 
  "process": "faq", 
  "error": null,
  "resultId": "RmluZE1hdGNoUmVzdWx0OjYxODhkZGMwMjE1MmZhYWVkNGExMDRmOA=="
}
```

## Match Feedback

<mark style="color:green;">`POST`</mark> `https://backend.alli.ai/webapi/match_feedback`

if there is no positive\_feedback, It just returns previous result without feedback.

If there is no feedback\_index, it returns all previous result.

Only for 'faq' process can apply feedback. and only 'faq', 'mrc' can get previous result

#### Headers

| Name                                      | Type   | Description                                                                                        |
| ----------------------------------------- | ------ | -------------------------------------------------------------------------------------------------- |
| API-KEY<mark style="color:red;">\*</mark> | String | Your cognitive search API key can be found in your dashboard Settings menu, under the General tab. |

#### Request Body

| Name                                         | Type    | Description                      |
| -------------------------------------------- | ------- | -------------------------------- |
| result\_id<mark style="color:red;">\*</mark> | String  | resultId from find\_match result |
| feedback\_index                              | Int     | result index                     |
| positive\_feedback                           | Boolean | true: positive, false:negative   |
