I'm deleting various records from my QnA Maker KB via the Invoke-RestMethod PowerShell command and then adding some new QnA's with the same command.
I'm finding that sometimes it works and sometimes I get a 400 Bad Request response with the details:
Invoke-RestMethod : {
"error": {
"code": "BadArgument",
"message": "Invalid input. See details.",
"details": [
{
"code": "ValidationFailure",
"message": "Kb: <KB Number> is already being updated by Operation: 9766ff66-f950-41ed-b0de-b77d8bc78c23. Please wait for it to complete.",
"target": "ConcurrentUpdates"
}
]
}
}
I don't think this is related to the JSON I'm sending as it doesn't fail or work consistently. When I get this response my QnA Maker is then locked from any changes for ~1 hr. I also get the same error if I click Save and Train in the QnA Maker portal.
Any ideas what's happening or how I can debug this?
Thank you Steven for pointing me in the right direction.
I tested copying and pasting the JSON body of my requests and sending via Postman and it worked perfectly. Following that I did lots of testing with Invoke-RestMethod and HTTPBin and found that one QnA I was trying to add had characters with accents. Invoke-RestMethod was converting the whole JSON body to Base64 in this case for some reason. Including "charset=utf-8" on the content type fixed it.
I think the locking out for an hour was just a symptom of me sending multiple bad requests to the QnA Maker api...