"use strict";(self.webpackChunknewoaks_help=self.webpackChunknewoaks_help||[]).push([[8401],{300:(e,t,s)=>{s.d(t,{A:()=>i});s(6540);var n=s(3532),r=s(4848);var o=s(767);const i={...s(5886).A,ApiUrl:function(e){let{path:t}=e;const s=(0,n.r)()(t);return(0,r.jsx)("code",{children:s})},ApiExample:o.Ay}},767:(e,t,s)=>{s.d(t,{Ay:()=>m,TM:()=>h,VQ:()=>c,iW:()=>d,r3:()=>l,zV:()=>u});s(6540);var n=s(3532),r=s(8069),o=s(9303),i=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 r=e.match(/^\s*/)?.[0]||"";n.push(`${r}// ${t[s[1]]}`)}n.push(e)})),n.join("\n")},h=e=>{let{path:t,method:s="POST"}=e;const r=(0,n.r)()(t)||`https://usapi.hottask.com${t}`;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("p",{children:[(0,i.jsx)("strong",{children:"Request URL:"})," ",r]}),(0,i.jsxs)("p",{children:[(0,i.jsx)("strong",{children:"Method:"})," ",s]})]})},d=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,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("p",{children:"The API request must include the following headers:"}),(0,i.jsx)("ul",{children:Object.entries(t).map((e=>{let[t,n]=e;return(0,i.jsxs)("li",{children:[(0,i.jsxs)("code",{children:[t,": ",n]})," - ",s[t]]},t)}))})]})},c=e=>{let{requestBody:t,requestBodyParams:s,addCommentsToJson:n=a}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("p",{children:"The request body should contain the following parameters:"}),(0,i.jsx)(r.A,{language:"json",children:n(t,s)}),(0,i.jsx)("ul",{children:Object.entries(s).map((e=>{let[t,s]=e;return(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:t})," - ",s]},t)}))})]})},l=e=>{let{method:t="POST",path:s,requestBody:a,headers:h={Authorization:"<Your-Secret-Key>","Content-Type":"application/json"}}=e;const d=(0,n.r)()(s),c="undefined"==typeof window?"usapi.hottask.com":new URL(d||`https://usapi.hottask.com${s}`).host,l={javascript:`const res = await fetch('${d||`https://usapi.hottask.com${s}`}', {\n  method: '${t}',\n  headers: ${JSON.stringify(h,null,2)}${a?`,\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 = '${d||`https://usapi.hottask.com${s}`}'\nheaders = ${JSON.stringify(h,null,4)}${a?`,\nbody: JSON.stringify(${JSON.stringify(a,null,2)})`:""}\n\nresponse = requests.${t.toLowerCase()}(url, headers=headers, json=data)\ndata = response.json()\nprint(data)`,bash:`curl '${d||`https://usapi.hottask.com${s}`}' \\\n  -X ${t} \\\n${Object.entries(h).map((e=>{let[t,s]=e;return`  -H '${t}: ${s}' \\`})).join("\n")}\n${a?`  -d '${JSON.stringify(a)}'`:""}`,http:`${t} ${s} HTTP/1.1\nHost: ${c}\n${Object.entries(h).map((e=>{let[t,s]=e;return`${t}: ${s}`})).join("\n")}\n\n${a?`${JSON.stringify(a,null,2)}`:""}`};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.A,{as:"h3",children:"JavaScript (Fetch API)"}),(0,i.jsx)(r.A,{language:"javascript",children:l.javascript}),(0,i.jsx)(o.A,{as:"h3",children:"Python (Requests Library)"}),(0,i.jsx)(r.A,{language:"python",children:l.python}),(0,i.jsx)(o.A,{as:"h3",children:"cURL"}),(0,i.jsx)(r.A,{language:"bash",children:l.bash}),(0,i.jsx)(o.A,{as:"h3",children:"HTTP Request"}),(0,i.jsx)(r.A,{language:"http",children:l.http})]})},u=e=>{let{responseExample:t,responseComments:s,addCommentsToJson:n=a}=e;const o={...t,Version:"1.0.0",Success:!0,Code:200,Message:""},h={...s,Version:"string - API version",Success:"boolean - Operation success status",Code:"integer - HTTP status code",Message:"string - Error message if any"};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("p",{children:"The API response will be a JSON object with the following structure:"}),(0,i.jsx)(r.A,{language:"json",children:n(o,h)})]})},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,i.jsx)("div",{style:{whiteSpace:"pre-line"},children:t})};function m(e){let{title:t,path:s,method:r="POST",description:o="",requestBody:m={timeZone:"Asia/Shanghai",type:0},requestBodyDescription:j={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:g={timeZone:"string, required",type:"integer, required"},responseExample:y={Data:"3254a9d0424c4806b9ea3d0763xxxxxx",Version:"1.0.0",Success:!0,Code:200,Message:""},responseComments:f={Data:"chatbot id"},headers:x={Authorization:"<Your-Secret-Key>","Content-Type":"application/json"},headersDescription:$={Authorization:"The secret key for authenticating the API request.","Content-Type":"The content type of the request payload."},errorHandling:w="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 T=(0,n.r)()(s),A="undefined"==typeof window?"usapi.hottask.com":new URL(T||`https://usapi.hottask.com${s}`).host;JSON.stringify(x,null,2),a(m,g),JSON.stringify(x,null,4),a(m,g),r.toLowerCase(),Object.entries(x).map((e=>{let[t,s]=e;return`  -H '${t}: ${s}' \\`})).join("\n"),JSON.stringify(m),Object.entries(x).map((e=>{let[t,s]=e;return`${t}: ${s}`})).join("\n"),a(m,g);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(h,{path:s,method:r}),(0,i.jsx)(d,{headers:x,headersDescription:$}),(0,i.jsx)(c,{requestBody:m,requestBodyParams:j,addCommentsToJson:a}),(0,i.jsx)(l,{method:r,path:s,requestBody:m,headers:x}),(0,i.jsx)(u,{responseExample:y,responseComments:f,addCommentsToJson:a}),(0,i.jsx)(p,{errorHandling:w})]})}},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})}}]);