Share via


Question Answering Projects - Get Qnas

Gets all the QnAs of a project.

GET {Endpoint}/language/authoring/query-knowledgebases/projects/{projectName}/qnas?api-version=2023-04-01
GET {Endpoint}/language/authoring/query-knowledgebases/projects/{projectName}/qnas?api-version=2023-04-01&top={top}&skip={skip}&maxpagesize={maxpagesize}&source={source}

URI Parameters

Name In Required Type Description
Endpoint
path True

string (uri)

Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com).

projectName
path True

string

maxLength: 100
pattern: ^(?=[a-zA-Z0-9])[a-zA-Z0-9-]{0,98}[a-zA-Z0-9]$

Name of the project.

api-version
query True

string

minLength: 1

The API version to use for this operation.

maxpagesize
query

integer (int32)

The maximum number of resources to include in a single response.

skip
query

integer (int32)

An offset into the collection of the first resource to be returned.

source
query

string

Source of the QnA.

top
query

integer (int32)

The maximum number of resources to return from the collection.

Responses

Name Type Description
200 OK

PagedRetrieveQnaRecord

The request has succeeded.

Other Status Codes

ErrorResponse

An unexpected error response.

Headers

x-ms-error-code: string

Security

Ocp-Apim-Subscription-Key

Type: apiKey
In: header

OAuth2Auth

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
https://cognitiveservices.azure.com/.default

Examples

Successful query

Sample request

GET {Endpoint}/language/authoring/query-knowledgebases/projects/proj1/qnas?api-version=2023-04-01

Sample response

{
  "value": [
    {
      "answer": "ans1",
      "dialog": {
        "isContextOnly": false,
        "prompts": [
          {
            "displayOrder": 1,
            "displayText": "prompt 1.1",
            "qnaId": 11
          },
          {
            "displayOrder": 2,
            "displayText": "prompt 1.2",
            "qnaId": 21
          }
        ]
      },
      "id": 1,
      "lastUpdatedDateTime": "2021-05-01T17:21:14Z",
      "metadata": {
        "k1": "v1",
        "k2": "v2"
      },
      "questions": [
        "question 1.1",
        "question 1.2"
      ],
      "source": "source1"
    },
    {
      "answer": "ans2",
      "id": 2,
      "lastUpdatedDateTime": "2021-05-01T17:21:14Z",
      "questions": [
        "question 2.1",
        "question 2.2"
      ],
      "source": "source2"
    }
  ]
}

Definitions

Name Description
Error

The error object.

ErrorCode

Human-readable error code.

ErrorResponse

Error response.

InnerErrorCode

Human-readable error code.

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.

PagedRetrieveQnaRecord

Paged collection of RetrieveQnaRecord items

QnaDialog

Dialog associated with QnA Record.

QnaPrompt

Prompt for an answer.

QnaRecord

QnA record.

RetrieveQnaRecord

QnA Record with last updated date-time.

SuggestedQuestion

Question suggested by the Active Learning feature.

SuggestedQuestionsCluster

Active Learning suggested questions cluster details.

Error

The error object.

Name Type Description
code

ErrorCode

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

InnerErrorModel

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.

ErrorCode

Human-readable error code.

Value Description
InvalidRequest

Invalid request error

InvalidArgument

Invalid argument error

Unauthorized

Unauthorized access error

Forbidden

Forbidden access error

NotFound

Not found error

ProjectNotFound

Project not found error

OperationNotFound

Operation not found error

AzureCognitiveSearchNotFound

Azure Cognitive Search not found error

AzureCognitiveSearchIndexNotFound

Azure Cognitive Search index not found error

TooManyRequests

Too many requests error

AzureCognitiveSearchThrottling

Azure Cognitive Search throttling error

AzureCognitiveSearchIndexLimitReached

Azure Cognitive Search index limit reached error

InternalServerError

Internal server error

ServiceUnavailable

Service unavailable error

Timeout

Timeout error

QuotaExceeded

Quota exceeded error

Conflict

Conflict error

Warning

Warning error

ErrorResponse

Error response.

Name Type Description
error

Error

The error object.

InnerErrorCode

Human-readable error code.

Value Description
InvalidRequest

Invalid request error

InvalidParameterValue

Invalid parameter value error

KnowledgeBaseNotFound

Knowledge base not found error

AzureCognitiveSearchNotFound

Azure Cognitive Search not found error

AzureCognitiveSearchThrottling

Azure Cognitive Search throttling error

ExtractionFailure

Extraction failure error

InvalidRequestBodyFormat

Invalid request body format error

EmptyRequest

Empty request error

MissingInputDocuments

Missing input documents error

InvalidDocument

Invalid document error

ModelVersionIncorrect

Model version incorrect error

InvalidDocumentBatch

Invalid document batch error

UnsupportedLanguageCode

Unsupported language code error

InvalidCountryHint

Invalid country hint error

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

InnerErrorCode

One of a server-defined set of error codes.

details

object

Error details.

innererror

InnerErrorModel

An object containing more specific information than the current object about the error.

message

string

Error message.

target

string

Error target.

PagedRetrieveQnaRecord

Paged collection of RetrieveQnaRecord items

Name Type Description
nextLink

string (uri)

The link to the next page of items

value

RetrieveQnaRecord[]

The RetrieveQnaRecord items on this page

QnaDialog

Dialog associated with QnA Record.

Name Type Description
isContextOnly

boolean

To mark if a prompt is relevant only with a previous question or not. If true, do not include this QnA as answer for queries without context; otherwise, ignores context and includes this QnA in answers.

prompts

QnaPrompt[]

List of prompts associated with the answer.

QnaPrompt

Prompt for an answer.

Name Type Description
displayOrder

integer (int32)

Index of the prompt. It is used for ordering of the prompts.

displayText

string

maxLength: 200

Text displayed to represent a follow up question prompt.

qna

QnaRecord

QnA record. Either QnAId or QnA record needs to be present in a Prompt.

qnaId

integer (int32)

ID of the QnA corresponding to the prompt.

QnaRecord

QnA record.

Name Type Description
activeLearningSuggestions

SuggestedQuestionsCluster[]

List of Active Learning suggestions for the QnA.

answer

string

minLength: 1
maxLength: 25000

Answer text.

dialog

QnaDialog

Context of a QnA.

id

integer (int32)

Unique ID for the QnA.

metadata

object

Metadata associated with the answer, useful to categorize or filter question answers.

questions

string[]

List of questions associated with the answer.

source

string

maxLength: 300

Source from which QnA was indexed e.g. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs .

RetrieveQnaRecord

QnA Record with last updated date-time.

Name Type Description
activeLearningSuggestions

SuggestedQuestionsCluster[]

List of Active Learning suggestions for the QnA.

answer

string

minLength: 1
maxLength: 25000

Answer text.

dialog

QnaDialog

Context of a QnA.

id

integer (int32)

Unique ID for the QnA.

lastUpdatedDateTime

string (date-time)

Date-time when the QnA was last updated.

metadata

object

Metadata associated with the answer, useful to categorize or filter question answers.

questions

string[]

List of questions associated with the answer.

source

string

maxLength: 300

Source from which QnA was indexed e.g. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs .

SuggestedQuestion

Question suggested by the Active Learning feature.

Name Type Description
autoSuggestedCount

integer (int32)

The number of times the question was suggested automatically by the Active Learning algorithm.

question

string

Question suggested by the Active Learning feature.

userSuggestedCount

integer (int32)

The number of times the question was suggested explicitly by the user.

SuggestedQuestionsCluster

Active Learning suggested questions cluster details.

Name Type Description
clusterHead

string

Question chosen as the head of suggested questions cluster by Active Learning clustering algorithm.

suggestedQuestions

SuggestedQuestion[]

List of all suggested questions for the QnA.