mirror of
https://gitee.com/270580156/weiyu.git
synced 2026-05-15 11:47:54 +00:00
1 line
4.9 KiB
JavaScript
1 line
4.9 KiB
JavaScript
"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[4897],{6143:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>d,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>c});const s=JSON.parse('{"id":"develop/server/service/agent","title":"Agent Service API","description":"Authentication","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/develop/server/service/agent.md","sourceDirName":"develop/server/service","slug":"/develop/server/service/agent","permalink":"/docs/docs/develop/server/service/agent","draft":false,"unlisted":false,"editUrl":"https://github.com/bytedesk/bytedesk/docs/develop/server/service/agent.md","tags":[],"version":"current","sidebarPosition":1,"frontMatter":{"sidebar_label":"Agent API","sidebar_position":1},"sidebar":"tutorialSidebar","previous":{"title":"Customer Service Development","permalink":"/docs/docs/category/customer-service-development"},"next":{"title":"Organization Development","permalink":"/docs/docs/category/organization-development"}}');var r=t(5723),a=t(6246);const i={sidebar_label:"Agent API",sidebar_position:1},d="Agent Service API",o={},c=[{value:"Authentication",id:"authentication",level:2},{value:"Agent Management",id:"agent-management",level:2},{value:"Get Agent List",id:"get-agent-list",level:3},{value:"Update Agent Status",id:"update-agent-status",level:3},{value:"Get Agent Statistics",id:"get-agent-statistics",level:3},{value:"Error Codes",id:"error-codes",level:2}];function l(e){const n={code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"agent-service-api",children:"Agent Service API"})}),"\n",(0,r.jsx)(n.h2,{id:"authentication",children:"Authentication"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:'# Get token\nPOST /api/auth/token\nContent-Type: application/json\n\n{\n "username": "admin@bytedesk.com",\n "password": "password"\n}\n\n# Response\n{\n "access_token": "eyJhbGciOiJIUzI1NiJ9...",\n "token_type": "Bearer",\n "expires_in": 3600\n}\n'})}),"\n",(0,r.jsx)(n.h2,{id:"agent-management",children:"Agent Management"}),"\n",(0,r.jsx)(n.h3,{id:"get-agent-list",children:"Get Agent List"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:'GET /api/agent/list\nAuthorization: Bearer {token}\n\n# Response\n{\n "code": 200,\n "data": [\n {\n "id": "agent_id",\n "nickname": "Agent Name",\n "avatar": "https://example.com/avatar.jpg",\n "status": "online",\n "role": "agent"\n }\n ]\n}\n'})}),"\n",(0,r.jsx)(n.h3,{id:"update-agent-status",children:"Update Agent Status"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:'PUT /api/agent/status\nAuthorization: Bearer {token}\nContent-Type: application/json\n\n{\n "status": "online" // online, offline, busy, away\n}\n\n# Response\n{\n "code": 200,\n "message": "Status updated successfully"\n}\n'})}),"\n",(0,r.jsx)(n.h3,{id:"get-agent-statistics",children:"Get Agent Statistics"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:'GET /api/agent/stats\nAuthorization: Bearer {token}\n\n# Response\n{\n "code": 200,\n "data": {\n "total_chats": 100,\n "avg_response_time": 30,\n "satisfaction_rate": 4.5,\n "online_duration": 28800\n }\n}\n'})}),"\n",(0,r.jsx)(n.h2,{id:"error-codes",children:"Error Codes"}),"\n",(0,r.jsxs)(n.table,{children:[(0,r.jsx)(n.thead,{children:(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.th,{children:"Code"}),(0,r.jsx)(n.th,{children:"Description"})]})}),(0,r.jsxs)(n.tbody,{children:[(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"200"}),(0,r.jsx)(n.td,{children:"Success"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"400"}),(0,r.jsx)(n.td,{children:"Bad Request"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"401"}),(0,r.jsx)(n.td,{children:"Unauthorized"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"403"}),(0,r.jsx)(n.td,{children:"Forbidden"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"404"}),(0,r.jsx)(n.td,{children:"Not Found"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"500"}),(0,r.jsx)(n.td,{children:"Server Error"})]})]})]})]})}function h(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},6246:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>d});var s=t(2155);const r={},a=s.createContext(r);function i(e){const n=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(a.Provider,{value:n},e.children)}}}]); |