เรียก QnA Maker ด้วย Postman

สร้าง QnA Maker ตามนี้ Exercise – Create a bot – Learn | Microsoft Docs

เสร็จแล้วก็ Publish จะได้ตัวอย่างการเรียกด้วย Postman และ Curl

POST /knowledgebases/65c21545-xxxx-4cc9-982f-35649a25398a/generateAnswer
Host: https://2021-11-qna.azurewebsites.net/qnamaker
Authorization: EndpointKey 6a5fc60b-xxxx-4121-a921-159eac6eec90
Content-Type: application/json
{"question":"<Your question>"}
curl -X POST https://2021-11-qna.azurewebsites.net/qnamaker/knowledgebases/65c21545-xxxx-4cc9-982f-35649a25398a/generateAnswer -H "Authorization: EndpointKey 6a5fc60b-xxxx-4121-a921-159eac6eec90" -H "Content-type: application/json" -d "{'question':'<Your question>'}"

ลองเรียกด้วย Postman

Response แต่ละแบบ

{
    "error": {
        "code": "Unauthorized",
        "message": "Authorization Failed"
    }
}
{
    "answers": [
        {
            "questions": [],
            "answer": "No good match found in KB.",
            "score": 0.0,
            "id": -1,
            "isDocumentText": false,
            "metadata": []
        }
    ],
    "activeLearningEnabled": false
}
{
    "answers": [
        {
            "questions": [
                "Hello",
                "Hi"
            ],
            "answer": "Hi man!",
            "score": 100.0,
            "id": 9,
            "source": "Editorial",
            "isDocumentText": false,
            "metadata": [],
            "context": {
                "isContextOnly": false,
                "prompts": []
            }
        }
    ],
    "activeLearningEnabled": false
}

Link