Submitting and retrieving Frequently Asked Questions
Last updated: 28 October 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 !
Update a predefined FAQ or index a new FAQ with a developer supplied id.
PUT https://api.viko.ai/v1-beta/{tenancy}/faqs/{folder}/{id} (note: no trailing slash)
Content-Type application/json (required)
X-Api-Key (required)
{
question: string (required)
answer: string (required)
context: string (optional)
link: string (optional)
}
Status 202 (Accepted)
{
question: string (required)
answer: string (required)
context: string (optional)
link: string (optional)
}
$ curl \
--header 'X-Api-Key: replaceme' \
--header 'Content-Type: application/json' \
--request PUT 'https://stub.viko.ai/v1-beta/acme/faqs/shipping/1' \
--data-raw '{
"question": "how much is next day shipping",
"answer": "$4.95",
"context": "We offer free standard delivery and premium next day delivery",
"link": "https://acme.com/shipping.html"
}'
{
"question": "how much is next day shipping",
"answer": "$4.95",
"context": "We offer free standard delivery and premium next day delivery",
"link": "https://acme.com/shipping.html"
}
GET https://api.viko.ai/v1-beta/{tenancy}/faqs/{folder}/{id} (note: no trailing slash)
X-Api-Key (required)
Status 200 (Ok)
{
question: string (required)
answer: string (required)
context: string (optional)
link: string (optional)
}
$ curl \
--header 'X-Api-Key: replaceme' \
'https://stub.viko.ai/v1-beta/acme/faqs/shipping/1'
{
"question": "how much is next day shipping?",
"answer": "$4.95",
"context": "We offer free standard delivery and premium next day delivery",
"link": "https://acme.com/shipping.html"
}
DELETE https://api.viko.ai/v1-beta/{tenancy}/faqs/{folder}/{id} (note: no trailing slash)
X-Api-Key (required)
Status 202 (Accepted)
{
status: "deleted" (required)
id: string (required)
}
$ curl \
--header 'X-Api-Key: replaceme' \
--request DELETE 'https://stub.viko.ai/v1-beta/acme/faqs/shipping/1'
{
"status": "deleted",
"id": "1"
}
GET https://api.viko.ai/v1-beta/{tenancy}/faqs/ (note: trailing slash)
X-Api-Key (required)
Status 200
{
folders: [
{
name: string
count: number
}
],
total: number (required) // total FAQs in the index
}
$ curl \
--header 'X-Api-Key: replaceme' \
'https://stub.viko.ai/v1-beta/acme/faqs/'
{
"folders": [
{
"name": "shipping",
"count": 1
}
],
"total": 1
}
GET https://api.viko.ai/v1-beta/{tenancy}/faqs/{folder}/ (note: trailing slash)
limit (optional - integer)
offset (optional - integer)
X-Api-Key (required)
Status 200
Body JSON object
{
folder: string (required)
faqs: [
{
id: string (required)
question: string (required)
answer: string (required)
context: string (optional)
link: string (optional)
}
],
total: number
}
$ curl \
--header 'X-Api-Key: replaceme' \
'https://stub.viko.ai/v1-beta/acme/faqs/shipping/?limit=10&offset=0'
{
"folder": "shipping",
"faqs": [
{
"id": "1",
"question": "how much is next day shipping?",
"answer": "$4.95",
"context": "We offer free standard delivery and premium next day delivery",
"link": "https://acme.com/shipping.html"
}
],
"total": 1
}
GET https://api.viko.ai/v1-beta/{tenancy}/aq/
X-Api-Key: (required)
Status: 200
{
aqs: [
{
question: string (required)
answer: string (required)
count: number (required) // number of times question was asked
}
],
total: number
}
$ curl \
--header 'X-Api-Key: replaceme' \
'https://stub.viko.ai/v1-beta/acme/aqs/'
{
"aqs": [
{
"question": "How much is next day shipping",
"answer": "$4.95",
"count": 5
}
],
"total": 1
}