Knowledgebase - Download
Download the knowledgebase.
GET {Endpoint}/qnamaker/v4.0/knowledgebases/{kbId}/{environment}/qna
GET {Endpoint}/qnamaker/v4.0/knowledgebases/{kbId}/{environment}/qna?source={source}&changedSince={changedSince}
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
Endpoint
|
path | True |
string |
Supported Cognitive Services endpoint (e.g., https://< qnamaker-resource-name> .api.cognitiveservices.azure.com). |
environment
|
path | True |
Specifies whether environment is Test or Prod. |
|
kb
|
path | True |
string |
Knowledgebase id. |
changed
|
query |
string |
changedSince property is used to return all QnAs created or updated after a specific time duration. The user can filter QnAs by seconds (s), minutes (m), hours (h) and days (d). The user may use any integral value along with the suffix for time. For instance, the value of 5m returns all QnA pairs updated or created in the last 5 minutes. |
|
source
|
query |
string |
The source property filter to apply. Sample value: Editorial, smartLight%20FAQ.tsv . |
Request Header
Name | Required | Type | Description |
---|---|---|---|
Ocp-Apim-Subscription-Key | True |
string |
Responses
Name | Type | Description |
---|---|---|
200 OK |
Collection of all Q-A in the knowledgebase. |
|
Other Status Codes |
Error response. |
Security
Ocp-Apim-Subscription-Key
Type:
apiKey
In:
header
Examples
Successful query
Sample Request
GET {Endpoint}/qnamaker/v4.0/knowledgebases/9d091697-fb8c-4ed5-9ac0-35bf8273bfff/Test/qna
Sample Response
{
"qnaDocuments": [
{
"id": 1,
"answer": "You can change the default message if you use the QnAMakerDialog. See this for details: https://docs.botframework.com/en-us/azure-bot-service/templates/qnamaker/#navtitle",
"source": "Custom Editorial",
"questions": [
"How can I change the default message from QnA Maker?"
],
"metadata": [],
"context": {
"isContextOnly": false,
"prompts": []
}
},
{
"id": 2,
"answer": "You can use our REST apis to create a KB. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/knowledgebase/create",
"source": "Custom Editorial",
"questions": [
"How do I programmatically create a KB?"
],
"metadata": [
{
"name": "category",
"value": "api"
}
],
"context": {
"isContextOnly": false,
"prompts": [
{
"displayOrder": 1,
"qnaId": 3,
"displayText": "Update KB"
}
]
}
},
{
"id": 3,
"answer": "You can use our REST apis to update your KB. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/knowledgebase/update",
"source": "Editorial",
"questions": [
"How do I programmatically update my KB?"
],
"metadata": [
{
"name": "category",
"value": "api"
}
],
"context": {
"isContextOnly": false,
"prompts": [
{
"displayOrder": 1,
"qnaId": 4,
"displayText": "Refresh Endpoint Keys"
}
]
}
},
{
"id": 4,
"answer": "You can use our REST apis to refresh endpoint keys. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/endpointkeys/refreshkeys",
"source": "Editorial",
"questions": [
"How do I programmatically refresh endpoint keys?"
],
"metadata": [],
"context": {
"isContextOnly": false,
"prompts": []
}
}
]
}
Definitions
Name | Description |
---|---|
Context |
Context associated with Qna to be updated. |
Environment |
Specifies whether environment is Test or Prod. |
Error |
The error object. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. |
Error |
One of a server-defined set of error codes. |
Error |
Error response. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. |
Inner |
An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. |
MetadataDTO |
Name - value pair of metadata. |
PromptDTO |
Prompt for an answer. |
Qna |
QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object |
Qn |
List of QnADTO |
QnADTO |
Q-A object. |
Context
Context associated with Qna to be updated.
Name | Type | Description |
---|---|---|
isContextOnly |
boolean |
To mark if a prompt is relevant only with a previous question or not. true - Do not include this QnA as search result for queries without context false - ignores context and includes this QnA in search result |
promptsToAdd |
List of prompts to be added to the qna. |
|
promptsToDelete |
integer[] |
List of prompts associated with qna to be deleted |
EnvironmentType
Specifies whether environment is Test or Prod.
Name | Type | Description |
---|---|---|
Prod |
string |
|
Test |
string |
Error
The error object. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.
Name | Type | Description |
---|---|---|
code |
One of a server-defined set of error codes. |
|
details |
Error[] |
An array of details about specific errors that led to this reported error. |
innerError |
An object containing more specific information than the current object about the error. |
|
message |
string |
A human-readable representation of the error. |
target |
string |
The target of the error. |
ErrorCodeType
One of a server-defined set of error codes.
Name | Type | Description |
---|---|---|
BadArgument |
string |
|
EndpointKeysError |
string |
|
ExtractionFailure |
string |
|
Forbidden |
string |
|
KbNotFound |
string |
|
NotFound |
string |
|
OperationNotFound |
string |
|
QnaRuntimeError |
string |
|
QuotaExceeded |
string |
|
SKULimitExceeded |
string |
|
ServiceError |
string |
|
Unauthorized |
string |
|
Unspecified |
string |
|
ValidationFailure |
string |
ErrorResponse
Error response. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.
Name | Type | Description |
---|---|---|
error |
The error object. |
InnerErrorModel
An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.
Name | Type | Description |
---|---|---|
code |
string |
A more specific error code than was provided by the containing error. |
innerError |
An object containing more specific information than the current object about the error. |
MetadataDTO
Name - value pair of metadata.
Name | Type | Description |
---|---|---|
name |
string |
Metadata name. |
value |
string |
Metadata value. |
PromptDTO
Prompt for an answer.
Name | Type | Description |
---|---|---|
displayOrder |
integer |
Index of the prompt - used in ordering of the prompts |
displayText |
string |
Text displayed to represent a follow up question prompt |
qna |
QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object |
|
qnaId |
integer |
Qna id corresponding to the prompt - if QnaId is present, QnADTO object is ignored. |
Qna
QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object
Name | Type | Description |
---|---|---|
answer |
string |
Answer text |
context |
Context of a QnA |
|
id |
integer |
Unique id for the Q-A. |
metadata |
List of metadata associated with the answer. |
|
questions |
string[] |
List of questions associated with the answer. |
source |
string |
Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs |
QnADocumentsDTO
List of QnADTO
Name | Type | Description |
---|---|---|
qnaDocuments |
QnADTO[] |
List of answers. |
QnADTO
Q-A object.
Name | Type | Description |
---|---|---|
answer |
string |
Answer text |
context |
Context of a QnA |
|
id |
integer |
Unique id for the Q-A. |
metadata |
List of metadata associated with the answer. |
|
questions |
string[] |
List of questions associated with the answer. |
source |
string |
Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs |