0
votes

Unable to update the Knowledge in QnA maker whereas i am able to add the data to my Knowledge Base.Below is my update related REQUEST object references: https://github.com/Azure-Samples/cognitive-services-qnamaker-java/blob/master/update-knowledge-base.java



    {
      "update": {
        "qnaList": [
          {
            "id": 0,
            "answer": "[92 Newcastle Court Roanoke, VA 24012](https://www.google.com/)",
            "questions": [
              "Where is Virginia  located",
              "What is the address of Roanoke",
              "Roanoke  address",
              "Roanoke location"
            ],
            "metadata": [
              {
                "name": "fragmenttype",
                "value": "location"
              },
              {
                "name": "locationname",
                "value": "Roanoke"
              },
              {
                "name": "type",
                "value": "locationinfo"
              }
            ]
          },
          {
            "id": 1,
            "answer": "[880 Oakwood St.Billerica, MA 01821](https://www.google.com/)",
            "questions": [
              "Where is Billerica  located",
              "What is the address of Billerica",
              "Billerica  address",
              "Billerica location"
            ],
            "metadata": [
              {
                "name": "fragmenttype",
                "value": "location"
              },
              {
                "name": "locationname",
                "value": "Billerica"
              },
              {
                "name": "type",
                "value": "locationinfo"
              }
            ]
          }
        ]
      }
    }

and error response is:



    {
        "error": {
            "code": 12,
            "message": "Parameter is null",
            "target": null,
            "details": null,
            "innerError": null
        }
    }

1

1 Answers

0
votes

Your API call should be as below format. More information can be found here

 "update": {
    "name": "QnA Maker FAQ Prompts Bot",
    "qnaList": [
      {
        "id": 2,
        "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": {
          "add": [],
          "delete": []
        },
        "metadata": {
          "add": [],
          "delete": []
        }
      }
    ]
}