Submitting and retrieving Frequently Asked Questions
Last updated: 16 June 2022
Existing, predefined FAQs can be indexed. When a question is posted, Viko will first perform a semantic search of all indexed FAQs. If no suitable match can be found, Viko will then try to extract or generate an answer using documents for context. For more information please read the introductory document explaining FAQs and Answered Questions (AQs)
The examples in this document use the stubbed endpoint. Remember to swap over to the real endpoint !
Submit a predefined FAQ for indexing. The appropriate folder will be created if it does not already exist.
Note: Documents and FAQs can reside in the same folder.
POST https://api.viko.ai/v1-beta/{tenancy}/faq/{folder}/
Parameters: tenancy, folder
Header: X-Api-Key (required)
Header: X-Title (Optional)
Header: X-Canonical-Url (Optional)
Content-Type: application/json
Body: JSON object
{
question: string (required)
answer: string (required)
}
Status: 202 (Accepted)
Body: JSON object
{
id: string (required) // generated FAQ id
}
$ curl \
--header 'X-Api-Key: replaceme' \
--header 'Content-Type: application/json' \
--request POST 'https://stub.viko.ai/v1-beta/acme/faq/shipping/' \
--data-raw '{
"question": "how much is next day shipping",
"answer": "$4.95"
}'
{
"id": "1"
}
Update a predefined FAQ.
PUT https://api.viko.ai/v1-beta/{tenancy}/faq/{folder}/{id}
Parameters: tenancy, folder, id (faq id)
Header: X-Api-Key (required)
Content-Type: application/json
Body: JSON object
{
question: string (required)
answer: string (required)
}
Status: 202 (Accepted)
Body: JSON object
{
question: string (required)
answer: string (required)
}
$ curl \
--header 'X-Api-Key: replaceme' \
--header 'Content-Type: application/json' \
--request PUT 'https://stub.viko.ai/v1-beta/acme/faq/shipping/1' \
--data-raw '{
"question": "how much is next day shipping",
"answer": "$3.95"
}'
{
"question": "how much is next day shipping",
"answer": "$3.95"
}
DELETE https://api.viko.ai/v1-beta/{tenancy}/faq/{folder}/{id}
Parameters: tenancy, folder, id (faq id)
Header: X-Api-Key (required)
Status: 202 (Accepted)
Body: JSON object
{
id: string (required)
}
$ curl \
--header 'X-Api-Key: replaceme' \
--request DELETE 'https://stub.viko.ai/v1-beta/acme/faq/shipping/1'
{
"id": "1"
}
GET https://api.viko.ai/v1-beta/{tenancy}/faq/{folder}/{id}
Parameters: tenancy, folder, id (faq id)
Header: X-Api-Key (required)
Status: 200 (Ok)
Body: JSON object
{
question: string (required)
answer: string (required)
}
$ curl \
--header 'X-Api-Key: replaceme' \
--request GET 'https://stub.viko.ai/v1-beta/acme/faq/shipping/1'
{
"question": "how much is next day shipping?",
"answer": "$4.95"
}
GET https://api.viko.ai/v1-beta/{tenancy}/faq/
Parameters: tenancy
Header: X-Api-Key (required)
Status: 200
Body: JSON object
{
folders: [
{
name: string (required)
}
]
}
$ curl \
--header 'X-Api-Key: replaceme' \
--request GET 'https://stub.viko.ai/v1-beta/acme/faq/'
{
"folders": [
{
"name": "shipping"
}
]
}
GET https://api.viko.ai/v1-beta/{tenancy}/faq/{folder}/
Parameters: tenancy, folder (folder name)
Header: X-Api-Key (required)
Status: 200
Body: JSON object
{
folder: string (required)
faq: [
{
id: string (required)
question: string (required)
answer: string (required)
}
]
}
$ curl \
--header 'X-Api-Key: replaceme' \
--request GET 'https://stub.viko.ai/v1-beta/acme/faq/shipping/'
{
"folder": "shipping",
"faqs": [
{
"id": "1",
"question": "how much is next day shipping?",
"answer": "$4.95"
}
]
}
GET https://api.viko.ai/v1-beta/{tenancy}/aq/
Parameters: tenancy Header: X-Api-Key (required)
Status: 200
Body: JSON object
{
aq: [
{
question: string (required)
answer: string (required)
count: number (required) // number of times question was asked
}
]
}
$ curl \
--header 'X-Api-Key: replaceme' \
--request GET 'https://stub.viko.ai/v1-beta/acme/aq/'
{
"folder": "shipping",
"faq": [
{
"id": "1",
"question": "how much is next day shipping?",
"answer": "$4.95"
}
]
}