Introduction
Recentl, I attended a webinar and it was very interested for me as they were talking about Bot. Also, I have started working on proposal for a customer to setup this for internal application, so that the end-user can find answer quickly.
Here, I am going to share my learning how to test API JSON code generated by BOT Framework's QnA Maker using Postman tool.
Pre-requisite
- Microsoft Live.com Account
- Setup Bot Service using BOT Framework's QnA Maker (https://qnamaker.ai/ OR qnamaker.botframework.com)
- Basic knowledge on how to install a plugin in Chrome browser.
Install Postman tool into Chrome Browser
Link: https://goo.gl/hdZRaE
Login to https://qnamaker.ai to get service published code
- Go to "My Services" tab and you will get the list of all services running under your account.
- Click on "View Code" and you will get the code in pop-up.
- Click on "Copy" button and paste the code in notepad.
- Launch Postman tool in Chrome to test your Bot services code.
- Update Host URL: Replace highlighted Subscription Key with your subscription key that can be found next to host keyword in your copied code in step2
Host: https://westus.api.cognitive.microsoft.com/qnamaker/v1.0/knowledgebases/455f66b0-cdb4-4f37-9acc-df77fcc79324/generateAnswer
- Add the below two headers
Ocp-Apim-Subscription-Key: 0aa5e7559452420389986d47dc4ff965
- Content-Type: application/json
- Update body test {"question":"hi"}
- Click on "Send" button.
- You will get the response code as below
{
"answer": "Hello",
"score": "100"
}
- In the same way, you can update the body text with your question and you wil get the answer from bot under response body.