QnA Maker API - How to programatically delete structured QnA files?

%3CLINGO-SUB%20id%3D%22lingo-sub-308997%22%20slang%3D%22en-US%22%3EQnA%20Maker%20API%20-%20How%20to%20programatically%20delete%20structured%20QnA%20files%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-308997%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20all%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20working%20on%20a%20programmatic%20solution%20to%20feed%20QnAs%20into%20QnA%20Maker.%20In%20order%20to%20do%20so%2C%20I%20use%20the%20API%20to%20provide%20structured%20data%2C%20as%20outlined%20here%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fcognitive-services%2Fqnamaker%2Fconcepts%2Fdata-sources-supported%23structured-data-format-through-import%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fcognitive-services%2Fqnamaker%2Fconcepts%2Fdata-sources-supported%23structured-data-format-through-import%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20reason%20is%2C%20I%20cannot%20use%20files%20nor%20urls%20and%20thus%20leave%20these%20fields%20blank%20when%20submitting%20my%20data.%20The%20input%20I%20being%20used%20looks%20like%3C%2FP%3E%3CP%3E%7B%22id%22%3A%3CINTEGER%3E%2C%3CBR%20%2F%3E%22answer%22%3A%22%3CTEXTUAL%20content%3D%22%22%3E%22%2C%3CBR%20%2F%3E%22questions%22%3A%5B%22%3CTEXTUAL%20content%3D%22%22%3E%22%5D%2C%3CBR%20%2F%3E%22metadata%22%3A%5B%5D%7D%3CBR%20%2F%3E%3CBR%20%2F%3EAs%20it%20turns%20out%2C%20I%20cannot%20provide%20any%20URLs%2C%20as%20the%20repositories%20are%20on%20premise%20and%20cannot%20be%20accessed%20by%20QnA%20Maker.%3C%2FTEXTUAL%3E%3C%2FTEXTUAL%3E%3C%2FINTEGER%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%2C%20my%20observation%20is%20that%20I%20cannot%20programatically%20delete%20my%20documents%20using%20the%20%22id%22%20which%20I%20provided%20in%20the%20initial%20submission.%20Actually%2C%20it%20appears%20that%20QnA%20Maker%20replaces%20my%20%22id%22%20by%20some%20internal%20counting%20which%20starts%20from%200%20for%20fresh%20KBs.%20Thus%2C%20it%20turns%20out%20that%20I%20can%20delete%20my%20Q%26amp%3BAs%20if%20I%20just%20guess%20these%20ids.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EMy%20questions%20therefore%20are%3A%3C%2FSTRONG%3E%3C%2FP%3E%3COL%3E%3CLI%3EIs%20the%20above%20observation%20correct%3F%20A%20hint%20pointing%20at%20the%20documentation%20on%20how%20these%20ids%20which%20are%20needed%20for%20deleting%20would%20be%20helpful.%3C%2FLI%3E%3CLI%3EIf%20yes%2C%20are%20there%20any%20thoughts%20of%20extending%20the%20behavior%20toward%20a%20fallback%20approach%2C%20i.e.%2C%20only%20if%20no%20%22id%22%20is%20given%2C%20this%20counting%20starting%20from%200%20is%20used%3F%3C%2FLI%3E%3CLI%3EIn%20the%20meantime%2C%20is%20there%20a%20way%20to%20programtically%20retrieve%20this%20internal%20%22id%22%20from%20QnA%20Maker%2C%20ideally%20as%20part%20of%20the%20success%20response%3F%3C%2FLI%3E%3C%2FOL%3E%3CP%3EThank%20you!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-314092%22%20slang%3D%22en-US%22%3ERe%3A%20QnA%20Maker%20API%20-%20How%20to%20programatically%20structured%20QnA%20files%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-314092%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Christian%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20JSON%20payload%20that%20I%20provided%20in%20my%20earlier%20post%20had%20the%20%22ID%22%20as%20well%20in%20it%2C%20but%20yours%20did%20not%20have%20it%2C%20so%20%26nbsp%3BI%20guess%20it%20ended%20up%20deleting%20all.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere%20is%20the%20JSON%20payload%20once%20again%20for%20your%20reference%3A%3C%2FP%3E%3CP%3E%7B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%3C%2FSPAN%3E%22delete%22%3A%20%7B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22ids%22%3A%20%5B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E3001%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%5D%2C%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22sources%22%3A%20%5B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22Custom%20Editorial%22%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%5D%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-312920%22%20slang%3D%22en-US%22%3ERe%3A%20QnA%20Maker%20API%20-%20How%20to%20programatically%20structured%20QnA%20files%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-312920%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Dhina%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethe%20thing%20is%20that%3C%2FP%3E%3CP%3E%7B%3C%2FP%3E%3CP%3E%22delete%22%3A%20%7B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22sources%22%3A%20%5B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22Custom%20Editorial%22%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%5D%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3Ein%20your%20above%20JSON%20empties%20the%20entire%20source.%20Thus%2C%20not%20only%20document%203001%20is%20deleted%20but%20in%20my%20tests%20also%20document%203002.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20and%20best%20regards%3C%2FP%3E%3CP%3EChristian%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-310075%22%20slang%3D%22en-US%22%3ERe%3A%20QnA%20Maker%20API%20-%20How%20to%20programatically%20structured%20QnA%20files%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-310075%22%20slang%3D%22en-US%22%3E%3CP%3EInteresting.%20But%2C%20after%20you%20had%20submitted%20the%20JSON%20with%203001%20and%203002%2C%20did%20you%20try%20deleting%20by%20passing%20either%203001%20or%203002%20as%20parameters%3F%20I%20am%20asking%20because%2C%20in%20my%20case%2C%20when%20I%20used%20these%20ids%20in%20my%20delete%20payload%2C%20the%20article%20got%20deleted%20(which%20I%20confirmed%20using%20the%20TEST%20button).%20That%20indicates%20to%20me%20that%20the%20IDs%20are%20intact.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-309582%22%20slang%3D%22en-US%22%3ERe%3A%20QnA%20Maker%20API%20-%20How%20to%20programatically%20structured%20QnA%20files%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-309582%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Dhina%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20tried%20to%20reproduce%20your%20suggestion.%20I%20submitted%20your%20JSON%20but%20the%20Ids%20got%20ignored%20again.%3C%2FP%3E%3CP%3EWhat%20I%20did%20is%20I%20used%20the%20patch%20snippet%20from%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fcognitive-services%2Fqnamaker%2Fquickstarts%2Fjava%23Update%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fcognitive-services%2Fqnamaker%2Fquickstarts%2Fjava%23Update%3C%2FA%3E%3C%2FP%3E%3CP%3Eto%20submit%20your%20JSON.%20If%20I%20download%20the%20knowledge%20base%2C%20I%20receive%20the%20following%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%7B%26nbsp%3B%3C%2FP%3E%3CP%3E%22qnaDocuments%22%3A%20%5B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%7B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22id%22%3A%20188%2C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22answer%22%3A%20%22You%20can%20change%20the%20default%20message%20if%20you%20use%20the%20QnAMakerDialog.%20See%20this%20for%20details%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.botframework.com%2Fen-us%2Fazure-bot-service%2Ftemplates%2Fqnamaker%2F%23navtitle%26quot%3B%2C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.botframework.com%2Fen-us%2Fazure-bot-service%2Ftemplates%2Fqnamaker%2F%23navtitle%22%2C%3C%2FA%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%22source%22%3A%20%22Custom%20Editorial%22%2C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%22questions%22%3A%20%5B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22How%20can%20I%20change%20the%20default%20message%20from%20QnA%20Maker%3F%22%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%5D%2C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%22metadata%22%3A%20%5B%5D%2C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%22alternateQuestionClusters%22%3A%20%5B%5D%2C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%22changeStatus%22%3A%20%22Update%22%2C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%22kbId%22%3A%20%22...%22%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%7D%2C%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%7B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%22id%22%3A%20189%2C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%22answer%22%3A%20%22You%20can%20use%20our%20REST%20apis%20to%20manage%20your%20KB.%20See%20here%20for%20details%3A%20%3CA%20href%3D%22https%3A%2F%2Fwestus.dev.cognitive.microsoft.com%2Fdocs%2Fservices%2F58994a073d9e04097c7ba6fe%2Foperations%2F58994a0...%26quot%3B%2C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwestus.dev.cognitive.microsoft.com%2Fdocs%2Fservices%2F58994a073d9e04097c7ba6fe%2Foperations%2F58994a0...%22%2C%3C%2FA%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%22source%22%3A%20%22Custom%20Editorial%22%2C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%22questions%22%3A%20%5B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22How%20do%20I%20programmatically%20update%20my%20KB%3F%22%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%5D%2C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%22metadata%22%3A%20%5B%5D%2C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%22alternateQuestionClusters%22%3A%20%5B%5D%2C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%22changeStatus%22%3A%20%22Update%22%2C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%22kbId%22%3A%20%22...%22%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%26nbsp%3B%3C%2FP%3E%3CP%3E%5D%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20you%20see%2C%20the%20ids%20188%20and%20189%20rather%20than%203001%20and%203002.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20anything%20obvious%20what%20I%20can%20do%20wrong%20at%20client%20side%20to%20have%20the%20Ids%20not%20be%20used%20within%20the%20QnA%20Maker%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20regards%3C%2FP%3E%3CP%3EChristian%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-309328%22%20slang%3D%22en-US%22%3ERe%3A%20QnA%20Maker%20API%20-%20How%20to%20programatically%20structured%20QnA%20files%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-309328%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Christian%2C%3C%2FP%3E%3CP%3EAs%20far%20as%20my%20understanding%20goes%2C%20you%20could%20use%20the%20any%20resource%2FURLs%20and%20the%20QnAMaker%20would%20extract%20and%20create%20KB.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%2C%20I%20just%20did%20a%20quick%20testing%20with%20your%20scenario%20and%20I%20am%20able%20to%20delete%20a%20particular%20document%20from%20the%20QnAMaker%20KB%20with%20the%20ID%20provided%20during%20the%20initial%20submission.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20refer%20to%20Update%20Knowledge%20API%20%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwestus.dev.cognitive.microsoft.com%2Fdocs%2Fservices%2F5a93fcf85b4ccd136866eb37%2Foperations%2F5ac266295b4ccd1554da7600%2Fconsole%26nbsp%3B%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwestus.dev.cognitive.microsoft.com%2Fdocs%2Fservices%2F5a93fcf85b4ccd136866eb37%2Foperations%2F5ac266295b4ccd1554da7600%2Fconsole%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFirstly%2C%20I%20used%20the%20below%20body%20to%20create%202%20documents%20in%20the%20KB.%3C%2FP%3E%3CP%3E%7B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%3C%2FSPAN%3E%22add%22%3A%20%7B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22qnaList%22%3A%20%5B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22id%22%3A%203001%2C%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22answer%22%3A%20%22You%20can%20change%20the%20default%20message%20if%20you%20use%20the%20QnAMakerDialog.%20See%20this%20for%20details%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.botframework.com%2Fen-us%2Fazure-bot-service%2Ftemplates%2Fqnamaker%2F%23navtitle%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.botframework.com%2Fen-us%2Fazure-bot-service%2Ftemplates%2Fqnamaker%2F%23navtitle%3C%2FA%3E%22%2C%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22source%22%3A%20%22Custom%20Editorial%22%2C%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22questions%22%3A%20%5B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22How%20can%20I%20change%20the%20default%20message%20from%20QnA%20Maker%3F%22%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%5D%2C%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22metadata%22%3A%20%5B%5D%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%2C%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22id%22%3A%203002%2C%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22answer%22%3A%20%22You%20can%20use%20our%20REST%20apis%20to%20manage%20your%20KB.%20See%20here%20for%20details%3A%20%3CA%20href%3D%22https%3A%2F%2Fwestus.dev.cognitive.microsoft.com%2Fdocs%2Fservices%2F58994a073d9e04097c7ba6fe%2Foperations%2F58994a073d9e041ad42d9baa%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwestus.dev.cognitive.microsoft.com%2Fdocs%2Fservices%2F58994a073d9e04097c7ba6fe%2Foperations%2F58994a073d9e041ad42d9baa%3C%2FA%3E%22%2C%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22source%22%3A%20%22Custom%20Editorial%22%2C%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22questions%22%3A%20%5B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22How%20do%20I%20programmatically%20update%20my%20KB%3F%22%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%5D%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%5D%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20verified%20that%20it%20created%20using%20the%20%22TEST%22%20button%20in%20the%20QnAMaker%20website.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENext%2C%20I%20used%20the%20below%20body%20to%20delete%20just%201%20document.%3C%2FP%3E%3CP%3E%7B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%3C%2FSPAN%3E%22delete%22%3A%20%7B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22ids%22%3A%20%5B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E3001%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%5D%2C%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22sources%22%3A%20%5B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%22Custom%20Editorial%22%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%5D%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22Apple-converted-space%22%3E%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20verified%20that%20it%20got%20deleted%20by%20using%20the%20%22TEST%22%20button%20again%20and%20the%20document%20is%20not%20found.%3C%2FP%3E%3CP%3EHope%20it%20helps!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDhina%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-898411%22%20slang%3D%22en-US%22%3ERe%3A%20QnA%20Maker%20API%20-%20How%20to%20programatically%20structured%20QnA%20files%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-898411%22%20slang%3D%22en-US%22%3E%3CP%3EYes%20internal%20id's%20get%20created%20for%20the%20questions%20that%20a%20created%20programatically%20using%20API.%20what%20i%20can%20think%20of%20is%20to%20specify%20some%20metadata%20(key-value%20pair)%20that%20you%20can%20use%20further%20to%20identify%20the%20question%20that%20you%20just%20have%20created%20in%20the%20KB.%20you%20may%20need%20to%20follow%20several%20step%20for%20deletion.%20First%2C%20you%20can%20get%20the%20KB%20JSON%20using%20an%20API%20Call%2C%20Next%20you%20need%20to%20parse%20and%20filter%20the%20response%20JSON.%20This%20may%20include%20several%20steps%20i.e.%20first%20you%20need%20to%20extract%20'qnaDocuments'%20array%20(array%20that%20contains%20all%20the%20questions%20from%20KB)%20from%20JSON%2C%20then%20you%20need%20to%20filter%20'qnaDocuments'%20array%20by%20the%20'Source'%20that%20you%20had%20specified%20while%20creating%20the%20questions.%20From%20here%20you%20can%20get%20the%20id's%20of%20all%20questions%20pertaining%20to%20that%20particular%20source.%20Next%20you%20need%20to%20further%20filter%20this%20by%20metadata%20that%26nbsp%3B%20you%20need%20to%20provide%20to%20uniquely%20identify%20each%20questions%20that%20you%20create%20through%20API%20which%20can%20further%20provide%20you%20the%20internal%20id%20of%20the%20question%20that%20you%20need%20to%20delete.%20Rest%20is%20simple%20API%20call%20to%20delete%20the%20question%20using%20the%20returned%20id.%3CBR%20%2F%3Ehope%20this%20will%20help%26nbsp%3B%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F260837%22%20target%3D%22_blank%22%3E%40dhinagaja%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Hello all,

 

I am working on a programmatic solution to feed QnAs into QnA Maker. In order to do so, I use the API to provide structured data, as outlined here

 

https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/concepts/data-sources-supported#s...

 

The reason is, I cannot use files nor urls and thus leave these fields blank when submitting my data. The input I being used looks like

{"id":<Integer>,
"answer":"<Textual Content>",
"questions":["<Textual Content>"],
"metadata":[]}

As it turns out, I cannot provide any URLs, as the repositories are on premise and cannot be accessed by QnA Maker.

 

Now, my observation is that I cannot programatically delete my documents using the "id" which I provided in the initial submission. Actually, it appears that QnA Maker replaces my "id" by some internal counting which starts from 0 for fresh KBs. Thus, it turns out that I can delete my Q&As if I just guess these ids.

 

My questions therefore are:

  1. Is the above observation correct? A hint pointing at the documentation on how these ids which are needed for deleting would be helpful.
  2. If yes, are there any thoughts of extending the behavior toward a fallback approach, i.e., only if no "id" is given, this counting starting from 0 is used?
  3. In the meantime, is there a way to programtically retrieve this internal "id" from QnA Maker, ideally as part of the success response?

Thank you!

 

6 Replies
Highlighted

Hi Christian,

As far as my understanding goes, you could use the any resource/URLs and the QnAMaker would extract and create KB.

 

Also, I just did a quick testing with your scenario and I am able to delete a particular document from the QnAMaker KB with the ID provided during the initial submission.

 

You can refer to Update Knowledge API : https://westus.dev.cognitive.microsoft.com/docs/services/5a93fcf85b4ccd136866eb37/operations/5ac2662...

 

Firstly, I used the below body to create 2 documents in the KB.

{

  "add": {

    "qnaList": [

      {

        "id": 3001,

        "answer": "You can change the default message if you use the QnAMakerDialog. See this for details: https://docs.botframework.com/en-us/azure-bot-service/templates/qnamaker/#navtitle",

        "source": "Custom Editorial",

        "questions": [

          "How can I change the default message from QnA Maker?"

        ],

        "metadata": []

      },

      {

        "id": 3002,

        "answer": "You can use our REST apis to manage your KB. See here for details: https://westus.dev.cognitive.microsoft.com/docs/services/58994a073d9e04097c7ba6fe/operations/58994a0...",

        "source": "Custom Editorial",

        "questions": [

          "How do I programmatically update my KB?"

        ]

      }

    ]

  }

}

 

I verified that it created using the "TEST" button in the QnAMaker website.

 

Next, I used the below body to delete just 1 document.

{

 "delete": {

    "ids": [

      3001

    ],

    "sources": [

      "Custom Editorial"

    ]

  }

}

 

I verified that it got deleted by using the "TEST" button again and the document is not found.

Hope it helps!

 

Dhina

 

Highlighted

Hi Dhina,

 

I tried to reproduce your suggestion. I submitted your JSON but the Ids got ignored again.

What I did is I used the patch snippet from 

https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/quickstarts/java#Update

to submit your JSON. If I download the knowledge base, I receive the following

 

"qnaDocuments": [   

{      "id": 188,      "answer": "You can change the default message if you use the QnAMakerDialog. See this for details: https://docs.botframework.com/en-us/azure-bot-service/templates/qnamaker/#navtitle",     

"source": "Custom Editorial",     

"questions": [        "How can I change the default message from QnA Maker?"      ],     

"metadata": [],     

"alternateQuestionClusters": [],     

"changeStatus": "Update",     

"kbId": "..."   

},   

{     

"id": 189,     

"answer": "You can use our REST apis to manage your KB. See here for details: https://westus.dev.cognitive.microsoft.com/docs/services/58994a073d9e04097c7ba6fe/operations/58994a0...

"source": "Custom Editorial",     

"questions": [        "How do I programmatically update my KB?"      ],     

"metadata": [],     

"alternateQuestionClusters": [],     

"changeStatus": "Update",     

"kbId": "..."    } 

]

}

 

As you see, the ids 188 and 189 rather than 3001 and 3002.

 

Is there anything obvious what I can do wrong at client side to have the Ids not be used within the QnA Maker?

 

Best regards

Christian

 

Highlighted

Interesting. But, after you had submitted the JSON with 3001 and 3002, did you try deleting by passing either 3001 or 3002 as parameters? I am asking because, in my case, when I used these ids in my delete payload, the article got deleted (which I confirmed using the TEST button). That indicates to me that the IDs are intact.

Highlighted

Hi Dhina,

 

the thing is that

{

"delete": {

    "sources": [

      "Custom Editorial"

    ]

  }

}

in your above JSON empties the entire source. Thus, not only document 3001 is deleted but in my tests also document 3002.

 

Thank you and best regards

Christian

 

Highlighted

Hi Christian,

 

The JSON payload that I provided in my earlier post had the "ID" as well in it, but yours did not have it, so  I guess it ended up deleting all.

 

Here is the JSON payload once again for your reference:

{

 "delete": {

    "ids": [

      3001

    ],

    "sources": [

      "Custom Editorial"

    ]

  }

}

Highlighted

Yes internal id's get created for the questions that a created programatically using API. what i can think of is to specify some metadata (key-value pair) that you can use further to identify the question that you just have created in the KB. you may need to follow several step for deletion. First, you can get the KB JSON using an API Call, Next you need to parse and filter the response JSON. This may include several steps i.e. first you need to extract 'qnaDocuments' array (array that contains all the questions from KB) from JSON, then you need to filter 'qnaDocuments' array by the 'Source' that you had specified while creating the questions. From here you can get the id's of all questions pertaining to that particular source. Next you need to further filter this by metadata that  you need to provide to uniquely identify each questions that you create through API which can further provide you the internal id of the question that you need to delete. Rest is simple API call to delete the question using the returned id.
hope this will help  @dhinagaja