Knowledgebase - Replace
Replace knowledgebase contents.
PUT {Endpoint}/qnamaker/v4.0/knowledgebases/{kbId}
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
Endpoint
|
path | True |
|
Supported Cognitive Services endpoint (e.g., https://< qnamaker-resource-name> .api.cognitiveservices.azure.com). |
|
kb
|
path | True |
|
Knowledgebase id. |
Request Header
| Name | Required | Type | Description |
|---|---|---|---|
| Ocp-Apim-Subscription-Key | True |
|
Request Body
| Name | Required | Type | Description |
|---|---|---|---|
| qnAList | True |
|
List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. |
Responses
| Name | Type | Description |
|---|---|---|
| 204 No Content |
HTTP 204 No content. |
|
| Other Status Codes |
Error response. |
Security
Ocp-Apim-Subscription-Key
Type:
apiKey
In:
header
Examples
Successful query
Sample Request
PUT {Endpoint}/qnamaker/v4.0/knowledgebases/9d091697-fb8c-4ed5-9ac0-35bf8273bfff
Ocp-Apim-Subscription-Key: {API key}
{
"qnAList": [
{
"id": 0,
"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": []
},
{
"id": 0,
"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"
}
]
}
]
}
Sample Response
Definitions
| Context |
Context of a QnA |
| 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 |
| QnADTO |
Q-A object. |
|
Replace |
Post body schema for Replace KB operation. |
Context
Context of a QnA
| Name | Type | Description |
|---|---|---|
| isContextOnly |
|
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 |
| prompts |
List of prompts associated with the answer. |
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 |
|
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 |
|
A human-readable representation of the error. |
| target |
|
The target of the error. |
ErrorCodeType
One of a server-defined set of error codes.
| Name | Type | Description |
|---|---|---|
| BadArgument |
|
|
| EndpointKeysError |
|
|
| ExtractionFailure |
|
|
| Forbidden |
|
|
| KbNotFound |
|
|
| NotFound |
|
|
| OperationNotFound |
|
|
| QnaRuntimeError |
|
|
| QuotaExceeded |
|
|
| SKULimitExceeded |
|
|
| ServiceError |
|
|
| Unauthorized |
|
|
| Unspecified |
|
|
| ValidationFailure |
|
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 |
|
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 |
|
Metadata name. |
| value |
|
Metadata value. |
PromptDTO
Prompt for an answer.
| Name | Type | Description |
|---|---|---|
| displayOrder |
|
Index of the prompt - used in ordering of the prompts |
| displayText |
|
Text displayed to represent a follow up question prompt |
| qna |
QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object |
|
| qnaId |
|
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
QnADTO
Q-A object.
| Name | Type | Description |
|---|---|---|
| answer |
|
Answer text |
| context |
Context of a QnA |
|
| id |
|
Unique id for the Q-A. |
| metadata |
List of metadata associated with the answer. |
|
| questions |
|
List of questions associated with the answer. |
| source |
|
Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs |
ReplaceKbDTO
Post body schema for Replace KB operation.
| Name | Type | Description |
|---|---|---|
| qnAList |
|
List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. |