0

I've successfully created my Knowledgebase using API. But I forgot to add some alternative questions and metadata for one of the pairs.

I've noticed PATH method in the API to update the Knowledebase, so updating kb is supported. I've created a payload which looked like this:

{
"add": {

},
"delete": {

},
"update": {
    "qnaList": [
       {
        "id": 1,
        "answer": "Answer",
        "source": "link_to_source",
        "questions": [
            "Question 1?",
            "Question 2?"
        ],
        "metadata": [
            {
                "name": "oldMetadata",
                "value": "oldMetadata"
            },
            {
                "name": "newlyAddedMetaData",
                "value": "newlyAddedMetaData"
            }
        ]
    }]}
}

I get back the following response HTTP 202 Accepted:

{
"operationState": "NotStarted",
"createdTimestamp": "2018-05-21T07:46:52Z",
"lastActionTimestamp": "2018-05-21T07:46:52Z",
"userId": "user_uuid",
"operationId": "operation_uuid"
}

So, looks like it worked. But in reality, this request doesn't take any affect.

When I check operation details, it returns me the following:

{
"operationState": "Succeeded",
"createdTimestamp": "2018-05-21T07:46:52Z",
"lastActionTimestamp": "2018-05-21T07:46:54Z",
"resourceLocation": "/knowledgebases/kb_uuid",
"userId": "user_uuid",
"operationId": "operation_uuid"
}

What am I doing wrong? And how should I update my kb via API properly?

Please help

Ilya Khadykin
  • 290
  • 6
  • 14
  • Strange thing, it looks like you are using it the right way – Nicolas R May 21 '18 at 12:12
  • @NicolasR, yeah, this is frustrating – Ilya Khadykin May 21 '18 at 20:45
  • Can you share the necessary information in order to duplicate your KB in my account and try to do this update on my side? Just to be sure.. – Nicolas R May 22 '18 at 09:39
  • @NicolasR, unfortunetly I cannot do that. It consist of some corporative information. Did you have something similar in the past or you update your kb without any issues (including metadata)? – Ilya Khadykin May 23 '18 at 05:04
  • I did not use this update method in the past, only while debugging people questions – Nicolas R May 23 '18 at 09:15
  • @NicolasR, today I had a conversation with a collegue of mine, he pointed out that I use wrong payload. So, it might be a mistake from my side. I will update this question once I figure it out – Ilya Khadykin May 23 '18 at 18:21

1 Answers1

1

I had the same problem, I discovered that it was necessary to have all the data of the json even if they were not used. In your case you need "name" and "urls" in the "update" section and "Delete" in "update/qnaList/questions" section:

{
  "add": {},
  "delete": {},
  "update": {
  "name": "nameofKbBase", //this
  "qnaList": [
      {
         "id": 2370,
        "answer": "DemoAnswerEdit",
        "source": "CustomSource",
        "questions": {
         "add": [
            "DemoQuestionEdit"
          ],
           "delete": [] //this
        },
        "metadata": { }
      }
     ],
    "urls": [] //this
  }
}