"use strict";(self.webpackChunknewoaks_help=self.webpackChunknewoaks_help||[]).push([[9098],{3588:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>h,contentTitle:()=>l,default:()=>p,frontMatter:()=>d,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"api/chatbot/knowledge/edit-chatbot-knowledge","title":"Edit Chatbot Knowledge Base","description":"The API enables you to edit the knowledge base data of a specified chatbot by sending a POST request to the /chat/Chatbot/EditKnowledge endpoint.","source":"@site/developer/api/002.chatbot/002.knowledge/104.edit-chatbot-knowledge.md","sourceDirName":"api/002.chatbot/002.knowledge","slug":"/api/chatbot/knowledge/edit-chatbot-knowledge","permalink":"/guides/developer/api/chatbot/knowledge/edit-chatbot-knowledge","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":20,"frontMatter":{"sidebar_position":20},"sidebar":"sidebar","previous":{"title":"Get Chatbot Knowledge Base","permalink":"/guides/developer/api/chatbot/knowledge/get-chatbot-knowledge"},"next":{"title":"Source","permalink":"/guides/developer/category/source"}}');var o=s(4848),i=s(8453),r=s(767),a=s(8175);const d={sidebar_position:20},l="Edit Chatbot Knowledge Base",h={},c=[{value:"Endpoint",id:"endpoint",level:2},{value:"Request Headers",id:"request-headers",level:2},{value:"Request Body",id:"request-body",level:2},{value:"Example Request",id:"example-request",level:2},{value:"Response",id:"response",level:2},{value:"Error Handling",id:"error-handling",level:2}];function u(e){const t={code:"code",h1:"h1",h2:"h2",header:"header",p:"p",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"edit-chatbot-knowledge-base",children:"Edit Chatbot Knowledge Base"})}),"\n",(0,o.jsxs)(t.p,{children:["The ",(0,o.jsx)(a.A,{})," API enables you to edit the knowledge base data of a specified chatbot by sending a ",(0,o.jsx)(t.code,{children:"POST"})," request to the ",(0,o.jsx)(t.code,{children:"/chat/Chatbot/EditKnowledge"})," endpoint."]}),"\n",(0,o.jsx)(t.h2,{id:"endpoint",children:"Endpoint"}),"\n",(0,o.jsx)(r.TM,{path:"/chat/Chatbot/EditKnowledge"}),"\n",(0,o.jsx)(t.h2,{id:"request-headers",children:"Request Headers"}),"\n",(0,o.jsx)(r.iW,{}),"\n",(0,o.jsx)(t.h2,{id:"request-body",children:"Request Body"}),"\n",(0,o.jsx)(r.VQ,{requestBody:{serialNumber:"3254a9d0424c4806b9ea3d0763ccf1bf",SiteMapUrl:"",EnableSyncSiteMap:!1,SyncSiteMapDays:0,fileList:["34322","34321"],text:"111111111",googleSheetUrl:"",isRetrainGoogleSheet:!0,websiteList:[{url:"https://www.google.com",retrain:!1}],qaList:[{key:"Question",value:"Answer"}]},requestBodyParams:{serialNumber:"string, required - The unique identifier (ID) of the chatbot",SiteMapUrl:"string, optional - URL of the sitemap",EnableSyncSiteMap:"boolean, optional - Whether to enable sitemap synchronization",SyncSiteMapDays:"integer, required when EnableSyncSiteMap is true - Sync frequency (Monthly:30, Weekly:7, Daily:1)",fileList:"array of strings, optional - List of file IDs",text:"string, optional - Text content to add",googleSheetUrl:"string, optional - URL of the Google Sheet",isRetrainGoogleSheet:"boolean, optional - Whether to retrain using Google Sheet data",websiteList:"array of objects, optional - List of websites to crawl","websiteList[].url":"string - Website URL","websiteList[].retrain":"boolean - Whether to retrain using this website",qaList:"array of objects, optional - List of Q&A pairs","qaList[].key":"string - Question","qaList[].value":"string - Answer"}}),"\n",(0,o.jsx)(t.h2,{id:"example-request",children:"Example Request"}),"\n",(0,o.jsx)(r.r3,{path:"/chat/Chatbot/EditKnowledge",requestBody:{serialNumber:"3254a9d0424c4806b9ea3d0763ccf1bf",fileList:["34322","34321"]}}),"\n",(0,o.jsx)(t.h2,{id:"response",children:"Response"}),"\n",(0,o.jsx)(r.zV,{responseExample:{Data:!0,Version:"1.0.0",Success:!0,Code:200,Message:""},responseComments:{Data:"boolean - Operation success status",Version:"string - API version",Success:"boolean - Overall success status",Code:"integer - HTTP status code",Message:"string - Error message if any"}}),"\n",(0,o.jsx)(t.h2,{id:"error-handling",children:"Error Handling"}),"\n",(0,o.jsx)(r.NH,{})]})}function p(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(u,{...e})}):u(e)}},767:(e,t,s)=>{s.d(t,{Ay:()=>g,NH:()=>p,TM:()=>d,VQ:()=>h,iW:()=>l,r3:()=>c,zV:()=>u});s(6540);var n=s(3532),o=s(8069),i=s(9303),r=s(4848);const a=function(e,t){void 0===t&&(t={});const s=JSON.stringify(e,null,2).split("\n"),n=[];return s.forEach((e=>{const s=e.match(/"([^"]+)":/);if(s&&t[s[1]]){const o=e.match(/^\s*/)?.[0]||"";n.push(`${o}// ${t[s[1]]}`)}n.push(e)})),n.join("\n")},d=e=>{let{path:t,method:s="POST"}=e;const o=(0,n.r)()(t)||`https://usapi.hottask.com${t}`;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{children:[(0,r.jsx)("strong",{children:"Request URL:"})," ",o]}),(0,r.jsxs)("p",{children:[(0,r.jsx)("strong",{children:"Method:"})," ",s]})]})},l=e=>{let{headers:t={Authorization:"<Your-Secret-Key>","Content-Type":"application/json"},headersDescription:s={Authorization:"string, required - The secret key for authenticating the API request","Content-Type":"string, required - The content type of the request payload (must be application/json)"}}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{children:"The API request must include the following headers:"}),(0,r.jsx)("ul",{children:Object.entries(t).map((e=>{let[t,n]=e;return(0,r.jsxs)("li",{children:[(0,r.jsxs)("code",{children:[t,": ",n]})," - ",s[t]]},t)}))})]})},h=e=>{let{requestBody:t,requestBodyParams:s,addCommentsToJson:n=a}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{children:"The request body should contain the following parameters:"}),(0,r.jsx)(o.A,{language:"json",children:n(t,s)}),(0,r.jsx)("ul",{children:Object.entries(s).map((e=>{let[t,s]=e;return(0,r.jsxs)("li",{children:[(0,r.jsx)("code",{children:t})," - ",s]},t)}))})]})},c=e=>{let{method:t="POST",path:s,requestBody:a,headers:d={Authorization:"<Your-Secret-Key>","Content-Type":"application/json"}}=e;const l=(0,n.r)()(s),h="undefined"==typeof window?"usapi.hottask.com":new URL(l||`https://usapi.hottask.com${s}`).host,c={javascript:`const res = await fetch('${l||`https://usapi.hottask.com${s}`}', {\n method: '${t}',\n headers: ${JSON.stringify(d,null,2)},\n body: JSON.stringify(${JSON.stringify(a,null,2)})\n});\n\nconst data = await res.json();\nconsole.log(data);`,python:`import requests\nimport json\n\nurl = '${l||`https://usapi.hottask.com${s}`}'\nheaders = ${JSON.stringify(d,null,4)}\ndata = ${JSON.stringify(a,null,2)}\n\nresponse = requests.${t.toLowerCase()}(url, headers=headers, json=data)\ndata = response.json()\nprint(data)`,bash:`curl '${l||`https://usapi.hottask.com${s}`}' \\\n -X ${t} \\\n${Object.entries(d).map((e=>{let[t,s]=e;return` -H '${t}: ${s}' \\`})).join("\n")}\n -d '${JSON.stringify(a)}'`,http:`${t} ${s} HTTP/1.1\nHost: ${h}\n${Object.entries(d).map((e=>{let[t,s]=e;return`${t}: ${s}`})).join("\n")}\n\n${JSON.stringify(a,null,2)}`};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.A,{as:"h3",children:"JavaScript (Fetch API)"}),(0,r.jsx)(o.A,{language:"javascript",children:c.javascript}),(0,r.jsx)(i.A,{as:"h3",children:"Python (Requests Library)"}),(0,r.jsx)(o.A,{language:"python",children:c.python}),(0,r.jsx)(i.A,{as:"h3",children:"cURL"}),(0,r.jsx)(o.A,{language:"bash",children:c.bash}),(0,r.jsx)(i.A,{as:"h3",children:"HTTP Request"}),(0,r.jsx)(o.A,{language:"http",children:c.http})]})},u=e=>{let{responseExample:t,responseComments:s,addCommentsToJson:n=a}=e;const i={...t,Version:"1.0.0",Success:!0,Code:200,Message:""},d={...s,Version:"string - API version",Success:"boolean - Operation success status",Code:"integer - HTTP status code",Message:"string - Error message if any"};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{children:"The API response will be a JSON object with the following structure:"}),(0,r.jsx)(o.A,{language:"json",children:n(i,d)})]})},p=e=>{let{errorHandling:t="If the request fails, you should:\n1. Check the HTTP status code for network-level errors\n2. Examine the `Code` and `Message` fields in the response for business-level errors\n3. The `Message` field will contain detailed error information"}=e;return(0,r.jsx)("div",{style:{whiteSpace:"pre-line"},children:t})};function g(e){let{title:t,path:s,method:o="POST",description:i="",requestBody:g={timeZone:"Asia/Shanghai",type:0},requestBodyDescription:m={timeZone:"The time zone of the chatbot. The standard time zone format: e.g., Asia/Shanghai or America/New_York.",type:"Create a generic chatbot with a fixed value of 0"},requestBodyComments:f={timeZone:"string, required",type:"integer, required"},responseExample:y={Data:"3254a9d0424c4806b9ea3d0763xxxxxx",Version:"1.0.0",Success:!0,Code:200,Message:""},responseComments:b={Data:"chatbot id"},headers:j={Authorization:"<Your-Secret-Key>","Content-Type":"application/json"},headersDescription:w={Authorization:"The secret key for authenticating the API request.","Content-Type":"The content type of the request payload."},errorHandling:x="If it's an HTTP network error, you should check the `HTTP status code`. If it's a business exception, you need to examine the `Code` and `Message` fields, which will provide the error details."}=e;const k=(0,n.r)()(s),q="undefined"==typeof window?"usapi.hottask.com":new URL(k||`https://usapi.hottask.com${s}`).host;JSON.stringify(j,null,2),a(g,f),JSON.stringify(j,null,4),a(g,f),o.toLowerCase(),Object.entries(j).map((e=>{let[t,s]=e;return` -H '${t}: ${s}' \\`})).join("\n"),JSON.stringify(g),Object.entries(j).map((e=>{let[t,s]=e;return`${t}: ${s}`})).join("\n"),a(g,f);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d,{path:s,method:o}),(0,r.jsx)(l,{headers:j,headersDescription:w}),(0,r.jsx)(h,{requestBody:g,requestBodyParams:m,addCommentsToJson:a}),(0,r.jsx)(c,{method:o,path:s,requestBody:g,headers:j}),(0,r.jsx)(u,{responseExample:y,responseComments:b,addCommentsToJson:a}),(0,r.jsx)(p,{errorHandling:x})]})}},8175:(e,t,s)=>{s.d(t,{A:()=>i});s(6540);var n=s(5872),o=s(4848);function i(){let e=(0,n.K)()();return["newoaks.ai","www.newoaks.ai","eu.newoaks.ai"].includes(e)&&(e="NewOaks AI"),"appointify.ai"===e&&(e="Appointify AI"),(0,o.jsx)("code",{children:e})}},3532:(e,t,s)=>{function n(){return function(e){if("undefined"==typeof window)return"";const t=window.location.hostname;let s="";return s="www.newoaks.ai"==t||"newoaks.ai"==t?"https://usapi.hottask.com":"eu.newoaks.ai"==t?"https://euapi.hottask.com":`https://${t}`,e?`${s}${e.startsWith("/")?e:`/${e}`}`:s}}s.d(t,{r:()=>n})},5872:(e,t,s)=>{function n(){return function(){return"undefined"==typeof window?"":window.location.hostname}}s.d(t,{K:()=>n})}}]);