Alterra.ai FAQ API
A QnA engine that answers straightforward questions. Convert your static FAQ files, knowledge bases, user guides or canned responses into a question answering system.
Using this API you may build your own conversational virtual agents and messenger bots, use it for site search or embed it in sales or support workflows. You may integrate it with live chat, call center, tech support or CRM solutions. You may build a fully autonomous solution or pair it up with live agents.
This API finds answers in a set of FAQ articles. Each article is a question – answer pair. (It may also contain additional information.)
Though it may appear similar to FAQ search, technically, this engine is not a search engine. It does not search for keywords in the FAQ files. It finds the right answer by analyzing and classifying historic user questions. In a sense, it is a query classifier.
Powered by Deep Learning algorithms, the system requires a training corpus of historic user queries with the correct answers assigned to them. The bigger the corpus, the higher the search quality. You upload your training corpus into the system via this API, too.
The system keeps a log of queries it receives. Past queries may be assigned correct answers, and added to the training corpus.
The API has four main parts:
- performing search,
- uploading and editing the FAQ articles,
- working with the training corpus and query log,
- managing FAQ settings
The first part is used during the serving time. It performs actual search. The user asks a question or enters a search query; you pass the query to this API, and it returns the search results, ordered by relevancy.
The other three parts are used ahead of time, to upload and edit data, and train machine learning.
The API may return more than one search result. If your application is a fully automated bot you may display only the first result. If it is used for site search you may display several results. If you have a human agent in the loop you may display several results to the agent and let him manually select which one to send to the end-user.
All APIs defined here follow the REST paradigm.
All methods require an API key. API key is passed as “Authorization” header in the request. You automatically receive your API key when you self-register for the service on Alterra’s website.
All GET
methods take arguments as CGI parameters in the URL.
All POST
and PUT
requests take arguments in the request body, which should be in JSON format.
All methods return JSON. It may be empty if the only result is an operation status which is reported as HTTP status code.
The end-point for this API is at http://next.alterra.ai/api/faq/v1/
Entities
Each entity is represented by a JSON object.
Article
One article (question-answer pair) from the FAQ document
Field name | Type | Always present | Description |
---|---|---|---|
id |
int | Y | |
question |
string | Y | Title of the article, aka canonical question |
answer |
string | Y | Full answer |
alt_answers |
list of strings | N | Other formulations of the answer |
snippet |
string | N | Short summary of the answer |
action |
string | N | Action to be taken in response to user query |
comment |
string | N | Private comment, not visible to end-users |
do_not_index |
bool | N | Disable indexing of the article |
Strings may contain HTML formatting.
Normally, only answer
is displayed to end-users. alt_answers
(optional) would be logically equivalent to answer
, but expressed in different words. They may be sometimes shown instead of the main answer, to make the bot appear “less robotic”.
Action is a semicolon-separated string, like: “key1:value1;key2:value2”. Action interpretation depends on search results consumers. For example, name of the key can be used to identify a method to be called in response to the user inquiry, in addition to or instead of displaying the answer. Examples of actions include: send email or a message, display a new webpage, create a support ticket, create a task in task management software or CRM, etc. Search consumers should ignore actions that they don’t recognize.
Rapid-resolution widget considers action “rapid-resolution:false” as a signal to inhibit Rapid-resolution popup window and the article will not raise the widget.
Web chat widget considers action “operator-fallback:true” as a signal to close the web chat widget and open fallback chat with a human operator like Intercom or Drift.
Note that by default question
is not a query. It is not indexed. If you want it to be indexed explicitly add it to queries.
Example:
{
"id": 42,
"question": "Where can I find more bots?",
"snippet": "There is no official bot store yet",
"answer": "There is no official bot store at the moment, so you‘ll have to ask your friends or search the web for now. We’re pretty sure you'll find some bots to play with."
}
Article objects are used in Articles API.
Query
Users ask questions in their own words. Many of these questions (queries) are logically equivalent and shall be answered by the same answer. They are all paraphrases of one canonical question (question
). These paraphrases (referred to as “queries”) are stored in the system and used for training AI.
These queries may be imported from the log of actual queries entered by actual users (see Log Entry
), or from other sources (e.g. public training corpora). They may be even thought up by you – think how you could rephrase the canonical question.
Field name | Type | Always present | Description |
---|---|---|---|
text |
string | Y | Query’s text |
hash |
string | N | A hash of this query’s text, used as its ID |
article_id |
int | Y | id of the FAQ article that answers this query |
article_id
shall be trusted; it is assigned by a human labeler and used for training the algorithm.
Zero article_id
can be used just to store queries in corpus for further labeling.
Example:
{
"text": "Where's the money Lebowski?",
"hash": 1138,
"article_id": 0
}
Query objects are used in Queries API.
Together, Articles and Queries form the training corpus for Machine Learning.
New queries stats
Results of the Create new queries API call
Field name | Type | Always present | Description |
---|---|---|---|
added |
int | N | Number of queries which were successfully added to the corpus |
skipped |
int | N | Number of queries which are already existing in the corpus and were not affected |
invalid |
int | N | Number of queries which have unknown article id (can only be non-empty if partial=true is specified) |
Example:
{
"added": 11,
"skipped": 23,
"invalid": 0
}
Log entry
The actual query that a user entered into the system in the past.
All or some of these user queries may be exported to the system and become a part of the training corpus. Other user queries may be pre-filtered as irrelevant, garbage, spam, etc. and ignored. Thus, not all queries from the raw query log belong to the training corpus.
Field name | Type | Always present | Description |
---|---|---|---|
query_text |
string | Y | User query text |
search_id |
string | Y | The ID of the search assigned when the search was performed |
query_hash |
string | Y | Normalized query text hash |
timestamp |
datetime | Y | Date and time in ISO 8601 (RFC 3339) format |
article_ids |
list of ints | N | List of article_ids returned by the search algorithm as the response to this query, in the order of relevancy (see Search Response ) |
Unlike article IDs in Queries
, these article IDs cannot be trusted. They are assigned by the search algorithm and may contain errors.
Example:
{
"query_text": "How do one discover new bots?",
"query_hash": "F95C6BB30EC32F55",
"search_id": "05F4F53B-4F5D8162-7852A351-4B90F22E",
"timestamp": "2017-03-29T12:00:35Z",
"article_ids": [42, 17, 5]
}
Log entry objects are used in Logs API.
Search response
List of all results returned by the search engine in response to given search query, ordered by relevancy (in websearch it would be called SERP)
Field name | Type | Always present | Description |
---|---|---|---|
search_id |
string | Y | The ID of the search |
query_hash |
string | Y | Normalized query text hash |
timestamp |
datetime | Y | Date and time in ISO 8601 (RFC 3339) format |
results |
list of search result objects | Y | List of search results, ordered by relevancy |
Example:
{
"search_id": "05F4F53B-4F5D8162-7852A351-4B90F22E",
"query_hash": "F95C6BB30EC32F55",
"timestamp": "2017-03-29T12:00:35Z",
"results": [
{
"article_id": 42,
"question": "Where can I find new bots",
"snippet": "In your internets",
},
{
"article_id": 17,
"question": "Where can I find new boots",
"snippet": "In a shop",
},
{
"article_id": 5,
"question": "Where can I find new boats",
"snippet": "On a wharf",
},
]
}
Search result
One result of FAQ search, represented by one FAQ article.
Field name | Type | Always present | Description |
---|---|---|---|
article_id |
int | Y | Article ID of the result |
question |
string | Y | Article title (aka canonical question) |
snippet |
string | N | A short snippet of the article text |
answer |
string | N | Full article text |
action |
string | N | Action to be taken in response to user inquiry |
Snippet and answer may contain HTML formatting.
Example:
{
"article_id": 42,
"question": "Where can I find more bots?"
}
Search response object is returned by the Search API.
Pre-defined articles
There is a number of pre-defined articles (classes) to treat user questions that don’t have answers in your FAQ files.
Pre-defined articles are editable and can be manually deleted from your corpus.
Title | ID | Indexed | Description |
---|---|---|---|
Wrong Language | -4 |
No |
Special article which shows up when the user query is detected to be non-English |
Garbage | -5 |
No |
Completely useless queries. Garbage. Trash. Spam. Not worth answering, ever. |
Ignore | -3 |
No |
Meaningful queries worth answering that however shall not be added to your FAQ file: off-topic, one-off, too ambiguous, too short, too long and complex for bot, requiring a non-public answer, etc. You may forward them to humans. |
To do | -2 |
No |
Meaningful on-topic questions that doesn’t have an answer in the current FAQ file, but should. You may create new articles and then re-assign these queries to them. Thus, the “to-do” name. |
Greeting | -6 |
No |
Enables your bot to initiate a conversation with the user. The bot will send the text of the Answer of this Article to the user, unprompted. |
Wrong Language: this API only supports English. The engine includes language identification algorithm. When it detects a non-English query it returns id=-4 and the respective answer. (You can edit it.)
Garbage, Ignore, To do: use these three classes for questions that don’t have answers in your FAQ file. (The table above describes the differences between the three.) If the user query is classified as one of these, the system will return a “No results found” message to the user.
Since the queries that fall under these categories are quite different from legitimate frequently asked questions, the search engine may be not as accurate on these queries, compared to good ones. Garbage in – garbage out …
Therefore, you have an option to deactivate some or all of these classes. You do it by setting ‘do_not_index = true’. (In fact, it is the default value.) If you do so, the ML system will not use the respective classes for training and will not reply with the “No results found” message. Instead, it will attempt to find an answer in your FAQ. Most likely, it will be incorrect. Garbage in – garbage out …
However, even if you decide to deactivate these classes, you should still use them when labeling the query log. Otherwise, if you try to label these “bad” queries as legitimate it will wreak havoc on the algorithms. Besides, you may later decide to activate these classes — your training corpus will be ready. You may always activate it by changing ‘do_not_index’ from ‘true’ to ‘false’.
Greeting: you may want your bot to be active and begin talking first, even if not prompted by the user. This pre-defined class is reserved for this purpose. You would program your bot to initiate the conversation with the message of this article.
Alternatively, you may make your system passive: it will wait until the user asks the first question. In that case, don’t call this class.
Feedback request
A request to record user feedback on a particular search response.
There are two types of user feedback: a feedback on the SERP as a whole (I looked at theese three suggested articles and they — or one of them — answered my question), or on a particular article (This article is the one I was looking for). The feedback can also be positive (you helped me) or negative (your suggestions didn’t answer my question).
Field name | Type | Required | Description |
---|---|---|---|
search_id |
string | Y | The ID of the search we’re giving feedback for |
article_id |
int | N | The relevant article id, if known |
positive |
bool | Y | Whether the feedback is positive or not |
Example:
{
"search_id": "05F4F53B-4F5D8162-7852A351-4B90F22E",
"article_id": 13,
"positive": true
}
Feedback requests are required by Feedback API.
FAQ settings
These settings allow you to combine your main FAQ corpus with pre-defined common corpora. Currently, there are two common corpora available:
chitchat
Contains dialogs that would enable your bot to answer small talk questions like “how are you?”, “are you a bot or a human?”, “thank you, good bye”, etc.
User queries related to these topics are independent of your knowledge base. They are common across all verticals. This engine comes with a collection of such common queries. The answers, however, are under your control — you would edit the default values as you think fit.
grab_info
This corpus covers the “contact me” user intent. Currently, it contains only one article “contact me – here is my email address”. Specifically, if the user message contains the user’s email address this occurrence is detected by this API and the ID of this class is returned, along with the respective user message.
Additionally, an email notification is automatically sent to you (to the email address you provided when registering at Alterra’s website.)
Merged FAQ
Name of the common FAQ corpus merged in your corpus.
Field name | Type | Always present | Description |
---|---|---|---|
name |
string | Y | Name of the merged common FAQ corpus |
FAQ settings
Object describing all settings for this API. It contains the list of common FAQs merged with your main corpus.
Field name | Type | Always present | Description |
---|---|---|---|
merge_in |
list of merged FAQ objects | N | Common corpora merged with your corpus |
disable_html_sanitizer |
bool | N | Set to true to disable processing of uploaded articles with HTML sanitizer |
use_speller |
bool | N | Set to false to disable built-in spelling correction |
do_not_index_question |
bool | N | Set to true to disable indexing of article title aka question |
max_answer_sentences |
int | N | Set the number of first answer sentences to index. Set to 0 if answer should not be indexed at all. By default is 8 |
corpus_is_public |
bool | N | Corpus is available for search by everyone |
bot_settings |
bot settings object | N | Settings for bots connected to corpus |
Bot settings
Settings of bots connected to corpus.
Field name | Type | Always present | Description |
---|---|---|---|
reply_delay |
int | N | Delay before bot’s answer, in seconds |
pause_duration |
int | N | Bot will be paused for this time interval after human answer. In seconds. By default it is 2 hours |
common_human_working_hours |
pair of int’s | N | Bot won’t work within working hours interval |
human_working_hours |
dist of day of week to int pairs | N | Working hours for particular days of week. Overrides common_human_working_hours |
Example:
{
"reply_delay": 5,
"pause_duration": 3600,
"common_human_working_hours": [8, 17],
"human_working_hours": {
"monday": [8, 17],
"tuesday": [8, 17],
"wednesday": [8, 17],
"thursday": [8, 17],
"friday": [8, 17],
},
]
}
Common FAQ
A common FAQ available to merge into your corpus.
Field name | Type | Always present | Description |
---|---|---|---|
name |
string | Y | Name of common FAQ |
description |
string | N | Human-readable description of the corpus |
For further info see FAQ Settings API.
Search API
This is the main part. It is used during the serving time. It performs actual search. The user queries your application, you pass the query to this API, which returns the search results, ordered by relevancy.
Given a user query, find relevant answer(s) in the FAQ: GET
from /api/faq/v1/search
Arguments
Field name | Type | Required | Description |
---|---|---|---|
query | string | Y | user query |
Example:
/api/faq/v1/search?query=How+can+I+contact+you
Server reply
A search response object (list of search results, ordered by relevancy)
Example:
{
"search_id": "73b61636-29b1-4bee-8845-3bc0ffe9a86a",
"results":
[
{
"article_id": "42",
"question": "Where can I find more bots?"
},
{
"article_id": "43",
"question": "Who can see me ‘online’?",
"snippet": "People can only see you online if you're sharing your last seen status with them."
}
]
}
Feedback API
Record a user feedback to a search results set: POST
to /api/faq/v1/feedback
Arguments
A feedback request object.
Server reply
An appropriate HTTP status.
Articles API
This part is used for uploading and editing FAQ articles.
Each POST, PUT or DELETE endpoint may be used with an optional CGI parameter train=true
to re-train ML models after API call succeeds. If you plan a run of consequent API calls updating the corpus, it is advised not to use train=true
, but rather invoke train API call for re-training of the ML models after finishing editing the training corpus with this API.
Each GET endopoint may be used with optional CGI parameters queries=true
(articles in the result list will contain the array of query texts) or query_objects=true
(articles in the result list will contain the array of query objects)
Add new articles: POST
to /api/faq/v1/articles
Upload new article(s) to the system. Either all or none article IDs must be provided. By default if all IDs are provided this method will succeed only if all these IDs are available (not used by any other article).
Arguments
Field name | In | Type | Always present | Description |
---|---|---|---|---|
body |
list of article objects | Y | new articles to upload |
|
partial | query |
bool |
N | If true a subset of given articles with available IDs will be added |
replace | query |
bool |
N | If true all previously existing articles will be erased before adding |
Example:
POST /api/faq/v1/articles?replace=true&train=true
[
{
"id": "42",
"question": "Where can I find more bots?",
"snippet": "There is no official store yet",
"answer": "There is no official store at the moment, so you‘ll have to ask your friends or search the web for now. We’re pretty sure you'll find some bots to play with.",
"queries": [
"where are bots?",
"more bots",
"bot store"
]
},
{
"id": "54",
"question": "Who can see me ‘online’?",
"answer": "People can only see you online if you're sharing your last seen status with them. There is one exception to this: people will be able to see you online for a brief period when you send them a message in a one-on-one chat or in a group where you both are members."
}
]
Server reply
List of identifiers of just uploaded articles.
If the articles
were uploaded with specific ids
then these ids are honored. If the articles
were uploaded without ids
then the system automatically assigns new ids to them. ids of all just uploaded articles are returned here.
Example:
[42,54]
Update existing articles: PUT
to /api/faq/v1/articles
Edit (replace) existing article(s). All article IDs must be provided. By default this method will succeed only if corpus already has an article for every provided ID
Arguments
Field name | In | Type | Always present | Description |
---|---|---|---|---|
body |
list of article objects | Y | data for articles you are updating |
|
partial | query |
bool |
N | If true will modify a subset of given articles |
Example:
PUT /api/faq/v1/articles?train=true
[
{
"id": 42,
"question": "Where can I find more bots?",
"snippet": "There is no official store yet",
"answer": "There is no official store at the moment, so you‘ll have to ask your friends or search the web for now. We’re pretty sure you'll find some bots to play with.",
"queries": [
"where are bots?",
"more bots",
"bot store"
]
},
{
"id": 54,
"question": "Who can see me ‘online’?",
"answer": "People can only see you online if you're sharing your last seen status with them. There is one exception to this: people will be able to see you online for a brief period when you send them a message in a one-on-one chat or in a group where you both are members."
}
]
Server reply
List of ids for replaced articles (as a confirmation).
Example:
[42,54]
Delete one article: DELETE
/api/faq/v1/articles/{article_id}
Server reply
Appropriate HTTP status
Get a list of articles: GET
from /api/faq/v1/articles
Export articles from the system. It could be used to retrieve all articles, or a portion of (with pagination).
Arguments
Field name | In | Type | Required | Description |
---|---|---|---|---|
offset | query |
int |
N | Offset in the sorted list of articles. May be negative (Then is applied from the end of the list) Default value is 0 |
limit | query |
int |
N | Maximum number of articles to return. Default value is 10 |
Example:
/api/faq/v1/articles?offset=42&limit=2&queries=true
Server reply
List of article objects
Example:
[
{
"article_id": 42,
"question": "Where can I find more bots?",
"answer": "There is no official store at the moment, so you‘ll have to ask your friends or search the web for now. We’re pretty sure you'll find some bots to play with.",
"queries": [
"where are bots?",
"more bots",
"bot store"
]
},
{
"article_id": 43,
"question": "Who can see me ‘online’?",
"snippet": "People can only see you online if you're sharing your last seen status with them.",
"answer": "People can only see you online if you're sharing your last seen status with them. There is one exception to this: people will be able to see you online for a brief period when you send them a message in a one-on-one chat or in a group where you both are members.",
"queries": []
}
]
Get one article: GET
from /api/faq/v1/articles/{article_id}
Export one specific article, identified by article_id, from the system.
Server reply
An article object or an appropriate HTTP status and error message
Example:
{
"article_id": 42,
"question": "Where can I find more bots?",
"answer": "There is no official store at the moment, so you‘ll have to ask your friends or search the web for now. We’re pretty sure you'll find some bots to play with."
}
Queries API
This part is used for working with the query log and training corpus for Machine Learning.
There are two types of queries:
- All queries entered by users in the past – see Log entries
- Queries admitted to the training corpus – see Queries
This API deals with the latter.
These two sets have a big overlap by may be not equal. Indeed, only legitimate user queries shall be added to the training corpus. Garbage and spam shall be discarded. On the other hand, some queries in the training corpus may come from sources other than logged user queries (e.g. other public training corpora).
Each POST, PUT or DELETE endpoint may be used with an optional CGI parameter train=true
to re-train ML models after API call succeeds. If you plan a run of consequent API calls updating the corpus, it is advised not to use train=true
, but rather invoke train API call for re-training of the ML models after finishing editing the training corpus with this API.
Update queries: POST
to /api/faq/v1/queries
Add new queries to the training corpus or update existing queries.
Only unique queries will be actually added. Existing queries will be replaced. The result will contain the list of query hashes corresponding to the given list of queries. Duplicate queries will have the same hashes. article_id
shall be determined by human labelers and must be set in all queries.
Arguments
Field name | In | Type | Required | Description |
---|---|---|---|---|
body |
list of query objects | Y | New queries to upload | |
partial | query |
bool |
N | If true a subset of given queries with known article_id s will be added |
article_id
field must be set in all queries
Example:
POST /api/faq/v1/queries?train=true
[
{
"text": "Who should I contact about my booking?",
"article_id": 2
},
{
"text": "Where is my confirmation?",
"article_id": 5
},
{
"text": "WHERE IS MY CONFIRMATION???",
"article_id": 5
},
]
Server reply
List of respective query hashes.
Example:
["67F227A57F1A496F", "47E25DF1D9BAF663", "47E25DF1D9BAF663"]
Create new queries: POST
to /api/faq/v1/queries/new
Add new queries and skip existing queries.
Only new queries will be added from given set, existing queries will not be affected.
If article_id
field is not set in a query or is zero, the query is assumed to be unlabeled, and is stored for future labeling.
The result will contain numbers of successfully added, skipped or invalid queries.
Number of invalid queries can only be non-zero if endpoint is called with partial=true
. In that case the number of invalid queries is the number of queries skipped because of unknown article_id
.
Arguments
Field name | In | Type | Required | Description |
---|---|---|---|---|
body |
list of query objects | Y | New queries to upload | |
partial | query |
bool |
N | If true a subset of given queries with known article_id s will be added |
Example:
POST /api/faq/v1/queries/new?partial=true
[
{
"text": "Who should I contact about my booking?",
"article_id": 2
},
{
"text": "Where is my booking confirmation?",
"article_id": 1000
},
{
"text": "WHERE IS MY LUGGAGE???",
"article_id": 0
},
]
Server reply
New queries stats object
Example:
{"Added": 1, "Skipped": 1, "Invalid": 1}
Delete one query: DELETE
/api/faq/v1/queries/{query_hash}
Server reply
Appropriate HTTP status
Get a list of queries: GET
from /api/faq/v1/queries/
Export query objects from the training corpus (with pagination). It could be used to retrieve all queries, or a portion of.
Arguments
Field name | Type | Required | Description |
---|---|---|---|
offset | int | N | Offset in the sorted list of queries. May be negative (Then is applied from the end of the list) |
limit | int | N | Number of queries to return. Default value is 100 |
Example:
/api/faq/v1/queries?offset=1138&limit=1
Server reply
List of query objects
Example:
[
{
"hash": "23db4",
"text": "Who should I contact about my booking?",
"article_id": 2
}
]
Get one query: GET
from /api/faq/v1/queries/{query_hash}
Export one specific query, identified by hash, from the training corpus.
Server reply
A query object
Example:
{
"hash": "34512",
"text": "Where is my confirmation?",
"article_id": 13
}
API for queries attached to FAQ articles
The queries for which the correct article is known with certainty can be retrieved and managed through this additional API which is article-based. These queries are “attached” to the appropriate article.
Update article’s queries: POST
to /api/faq/v1/articles/{article_id}/queries
Attach queries to a specific article. If given queries are attached to other articles, they are detached and attached to the selected article.
Arguments
Field name | Type | Required | Description |
---|---|---|---|
body | list of query objects | N | Queries to attach |
hash
and article_id
are ignored.
Example:
[
{
"text": "Where is my booking confirmation?"
}
]
Server reply
List of respective query hashes
Example:
["706CB0285892CF2E"]
Delete one query attached to the article: DELETE
/api/faq/v1/articles/{article_id}/queries/{query_id}
Server reply
Appropriate HTTP status
Get list of queries attached to the article: GET
from /api/faq/v1/articles/{article_id}/queries
Arguments
Field name | Type | Required | Description |
---|---|---|---|
offset | int | N | zero-based |
limit | int | N | default value 100. Max value 1000 |
Example:
/api/faq/v1/articles/1/queries?offset=1138&limit=2
Server reply
List of query objects
Example:
[
{
"hash": "123e4",
"article_id": 1,
"text": "Where's the money Lebowski?"
},
{
"id": "9ffc94",
"article_id": 1,
"text": "Who should I contact about my booking?"
}
]
Get one query attached to the article: GET
from /api/faq/v1/articles/{article_id}/queries/{query_hash}
Retrieve one specific query, identified by the query_hash
Server reply
Query object
Log API
This part is used for working with the raw log of all queries entered by end-users in the past – see Log entries. The set of queries in this log may not fully coincide with the Queries in the training corpus. Indeed, only legitimate user queries shall be added to the training corpus. Garbage and spam may be discarded.
The intended use of this API is as follows. The system logs all end-user queries. You retrieve them, one-by-one or in bulk, make humans assign the right canonical answer (article id) to each query, add them to the training set (via Queries API), and invoke re-training of the ML models. You may use dedicated (hired) labelers or rely on the end-user or community feedback.
For you, the raw query log is read-only. The system logs all end-user queries, as is. You may retrieve them, but not modify.
Get list of log entries: GET
from /api/faq/v1/log
Export log entry objects from the the raw query log (with pagination). It could be used to retrieve the entire query log, or a portion of.
Arguments
Field name | Type | Required | Description |
---|---|---|---|
offset | int | N | Offset in the list of log entries (sorted from oldest to newest). May be negative (Then it is applied from the end of the list, thus taking N newest entries) |
limit | int | N | default value 10. Max value 1000 |
Example:
/api/faq/v1/log?timestamp=2017-03-21&offset=4238&limit=1
Server reply
List of log entry objects
Example:
[
{
"query": "How can I pay?",
"search_id": "73b61636-29b1-4bee-8845-3bc0ffe9a86a",
"query_hash": "01C5A0BBD64963CC",
"timestamp": "2017-03-21T13:23:53+00:00",
"result_ids": [ 3, 5, 8 ]
}
]
Get one log entry: GET
from /api/faq/v1/log/{search_id}
Retrieve one specific log entry, identified by the search_id
.
Server reply
Log entry object
Example:
{
"query": "How can I pay?",
"search_id": "73b61636-29b1-4bee-8845-3bc0ffe9a86a",
"query_hash": "01C5A0BBD64963CC",
"timestamp": "2017-03-21T13:23:53+00:00",
"result_ids": [ 3, 5, 8 ]
}
Train Machine Learning API
This API invokes re-training of ML algorithms and re-indexing data, after completing editing the training corpus.
Train Machine Learning: POST
to /api/faq/v1/train
Re-train ML algorithms and re-index data.
Arguments
None
Server reply
Appropriate HTTP status
FAQ settings API
This API allows you to combine your main FAQ corpus with pre-defined common corpora and do some other fine-tuning.
When a common corpus is merged, it adds a set of articles to your FAQ. Merged articles are modifiable. The articles will become indexed and searchable after a Train API call.
If a common corpus is un-merged, all its articles will be removed from the main FAQ, with all its attached queries. If you had added a corpus, edited it and then un-merge it you will lose all your edits.
If your corpus is a plain-text one, we suggest you to set disable_html_sanitizer
to true
in settings to prevent transformation of symbols in text to HTML entities.
Get FAQ settings: GET
from /api/faq/v1/faq_settings
Retrieve FAQ settings
Server reply
FAQ settings object
Example:
{
"merge_in": [
{ "name": "chitchat" }
]
}
Upload new FAQ settings: POST
to /api/faq/v1/articles/faq_settings
Arguments
Field name | Type | Required | Description |
---|---|---|---|
body | FAQ settings object | Y | New settings |
Example:
{
"merge_in": [
{ "name": "chitchat" }
],
"use_speller": false,
"max_answer_sentences": 0
}
Server reply
Appropriate HTTP status
Get list of common FAQ corpora: GET
from /api/faq/v1/commonFaqs
Get a list of all available common FAQs you can merge into your own corpus.
Arguments
Does not take any arguments
Server reply
A list of common FAQ objects
Example:
[{
"name": "chitchat",
"description": "Small talk / chitchat corpus"
}]