How To Test API JSON Code Generated By Bot Framework's Qna Maker Using Postman Tool

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 
  1. Microsoft Live.com Account
  2. Setup Bot Service using BOT Framework's QnA Maker (https://qnamaker.ai/ OR qnamaker.botframework.com)
  3. 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
  1. Go to "My Services" tab and you will get the list of all services running under your account.



  2. Click on "View Code" and you will get the code in pop-up.
  3. Click on "Copy" button and paste the code in notepad.



  4. Launch Postman tool in Chrome to test your Bot services code.

  1. 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 

  2. Add the below two headers           

     Ocp-Apim-Subscription-Key: 0aa5e7559452420389986d47dc4ff965

  3. Content-Type: application/json

  4. Update body test {"question":"hi"}

  5. Click on "Send" button.

  6. You will get the response code as below 

    {
    "answer": "Hello",
    "score": "100"
    }

  7. In the same way, you can update the body text with your question and you wil get the answer from bot under response body.
Ebook Download
View all
Learn
View all