{"id":6677,"date":"2026-04-29T16:30:53","date_gmt":"2026-04-29T08:30:53","guid":{"rendered":"https:\/\/www.babel.cc\/blog\/?p=6677"},"modified":"2026-04-29T16:30:53","modified_gmt":"2026-04-29T08:30:53","slug":"%e4%bc%81%e4%b8%9a%e4%ba%91%e7%9b%98api%e9%9b%86%e6%88%90%e6%9c%80%e4%bd%b3%e5%ae%9e%e8%b7%b5%ef%bc%9a%e4%bb%8e%e8%ae%a4%e8%af%81%e6%8e%88%e6%9d%83%e5%88%b0%e4%ba%8b%e4%bb%b6%e9%a9%b1%e5%8a%a8","status":"publish","type":"post","link":"https:\/\/www.babel.cc\/blog\/?p=6677","title":{"rendered":"\u4f01\u4e1a\u4e91\u76d8API\u96c6\u6210\u6700\u4f73\u5b9e\u8df5\uff1a\u4ece\u8ba4\u8bc1\u6388\u6743\u5230\u4e8b\u4ef6\u9a71\u52a8\u7684\u5b8c\u6574\u67b6\u6784"},"content":{"rendered":"<p>\u5728\u4f01\u4e1a\u6570\u5b57\u5316\u8f6c\u578b\u6d6a\u6f6e\u4e2d\uff0c\u4f01\u4e1a\u4e91\u76d8\u65e9\u5df2\u4ece\u7b80\u5355\u7684\u6587\u4ef6\u5b58\u50a8\u5de5\u5177\u6f14\u53d8\u4e3a\u6838\u5fc3\u4e1a\u52a1\u7cfb\u7edf\u3002CRM\u9700\u8981\u8bfb\u53d6\u5408\u540c\u9644\u4ef6\u3001ERP\u9700\u8981\u8c03\u7528\u56fe\u7eb8\u6587\u4ef6\u3001OA\u9700\u8981\u540c\u6b65\u5ba1\u6279\u6587\u6863\u2014\u2014\u8fd9\u4e9b\u573a\u666f\u7684\u5171\u540c\u7279\u70b9\u662f\uff1a<strong>\u4f01\u4e1a\u4e91\u76d8\u5fc5\u987b\u4f5c\u4e3a\u57fa\u7840\u8bbe\u65bd\u5bf9\u5916\u66b4\u9732API\u80fd\u529b<\/strong>\u3002<\/p>\n<p>\u4f46\u5f00\u653eAPI\u662f\u4e00\u628a\u53cc\u5203\u5251\u3002\u7528\u5f97\u597d\uff0c\u6548\u7387\u63d0\u534710\u500d\uff1b\u7528\u5f97\u5dee\uff0c\u6570\u636e\u6cc4\u9732\u3001\u6743\u9650\u5931\u63a7\u3001\u63a5\u53e3\u6ee5\u7528\u7b49\u95ee\u9898\u968f\u4e4b\u800c\u6765\u3002\u672c\u6587\u4ece\u8ba4\u8bc1\u6388\u6743\u3001API\u8bbe\u8ba1\u3001\u4e8b\u4ef6\u9a71\u52a8\u67b6\u6784\u3001SDK\u96c6\u6210\u56db\u4e2a\u7ef4\u5ea6\uff0c\u62c6\u89e3\u4f01\u4e1a\u4e91\u76d8API\u96c6\u6210\u7684\u5b8c\u6574\u6280\u672f\u65b9\u6848\u3002<\/p>\n<hr \/>\n<h2>\u4e00\u3001\u8ba4\u8bc1\u6388\u6743\uff1aOAuth2 + JWT \u7684\u53cc\u5c42\u9632\u7ebf<\/h2>\n<p>\u4f01\u4e1a\u4e91\u76d8\u7684API\u5b89\u5168\u6838\u5fc3\u5728\u4e8e<strong>\u8eab\u4efd\u9a8c\u8bc1<\/strong>\u548c<strong>\u6743\u9650\u63a7\u5236<\/strong>\u4e24\u5c42\u903b\u8f91\u3002<\/p>\n<h3>1.1 \u4e3a\u4ec0\u4e48\u4e0d\u7528\u5171\u4eab\u8d26\u53f7\u5bc6\u7801\uff1f<\/h3>\n<p>\u5f88\u591a\u65e9\u671f\u96c6\u6210\u65b9\u6848\u91c7\u7528&#8221;\u7ed9\u7cfb\u7edf\u5efa\u4e00\u4e2a\u8d26\u53f7\u3001\u5171\u4eab\u8d26\u53f7\u5bc6\u7801&#8221;\u7684\u6a21\u5f0f\u3002\u8fd9\u5e26\u6765\u4e86\u4e09\u4e2a\u81f4\u547d\u95ee\u9898\uff1a<\/p>\n<ul>\n<li><strong>\u6743\u9650\u9897\u7c92\u5ea6\u592a\u7c97<\/strong>\uff1a\u8be5\u8d26\u53f7\u8981\u4e48\u80fd\u8bbf\u95ee\u6240\u6709\u6587\u4ef6\uff0c\u8981\u4e48\u5b8c\u5168\u4e0d\u80fd\u8bbf\u95ee<\/li>\n<li><strong>\u65e0\u6cd5\u5ba1\u8ba1<\/strong>\uff1a\u7cfb\u7edfA\u548c\u7cfb\u7edfB\u7684\u64cd\u4f5c\u5206\u4e0d\u6e05\u662f\u8c01\u5e72\u7684<\/li>\n<li><strong>\u5bc6\u7801\u8f6e\u6362\u56f0\u96be<\/strong>\uff1a\u6539\u5bc6\u7801\u9700\u8981\u901a\u77e5\u6240\u6709\u4e0b\u6e38\u7cfb\u7edf\u4e00\u8d77\u66f4\u65b0<\/li>\n<\/ul>\n<p>\u6b63\u786e\u505a\u6cd5\u662f\u5f15\u5165<strong>OAuth2.0\u5ba2\u6237\u7aef\u51ed\u8bc1\u6a21\u5f0f\uff08Client Credentials\uff09<\/strong>\uff0c\u8ba9\u6bcf\u4e2a\u96c6\u6210\u7cfb\u7edf\u62e5\u6709\u72ec\u7acb\u7684\u5e94\u7528\u8eab\u4efd\u3002<\/p>\n<h3>1.2 OAuth2 \u4ee4\u724c\u53d1\u653e\u6d41\u7a0b<\/h3>\n<pre><code>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510    POST \/oauth\/token    \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\r\n\u2502  \u4e0b\u6e38\u7cfb\u7edf    \u2502 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2192 \u2502   \u4e91\u76d8\u6388\u6743\u670d\u52a1\u5668   \u2502\r\n\u2502 (client_id, \u2502                         \u2502                  \u2502\r\n\u2502  client_sec)\u2502 \u2190\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2502  \u9a8c\u8bc1\u5e94\u7528\u8eab\u4efd     \u2502\r\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518    { access_token }     \u2502  \u8fd4\u56deJWT\u4ee4\u724c      \u2502\r\n                                        \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\r\n<\/code><\/pre>\n<p>\u5177\u4f53\u5b9e\u73b0\u4ee3\u7801\uff08Node.js\uff09\uff1a<\/p>\n<pre><code class=\"language-javascript\">const axios = require('axios');\r\nconst jwt = require('jsonwebtoken');\r\n\r\nasync function getAccessToken() {\r\n  const response = await axios.post('https:\/\/api.babelcloud.cn\/oauth\/token', {\r\n    grant_type: 'client_credentials',\r\n    client_id: process.env.CLIENT_ID,\r\n    client_secret: process.env.CLIENT_SECRET,\r\n    scope: 'file:read file:write'\r\n  });\r\n\r\n  return response.data.access_token;\r\n}\r\n\r\n\/\/ \u4ee4\u724c\u6709\u6548\u671f\u5efa\u8bae\u8bbe\u4e3a2\u5c0f\u65f6\uff0c\u5ba2\u6237\u7aef\u9700\u505a\u81ea\u52a8\u5237\u65b0\r\nasync function callApiWithToken() {\r\n  let token = await getAccessToken();\r\n\r\n  try {\r\n    return await axios.get('https:\/\/api.babelcloud.cn\/v1\/files', {\r\n      headers: { Authorization: `Bearer ${token}` }\r\n    });\r\n  } catch (err) {\r\n    if (err.response?.status === 401) {\r\n      \/\/ \u4ee4\u724c\u8fc7\u671f\uff0c\u5237\u65b0\r\n      token = await getAccessToken();\r\n      return await axios.get('https:\/\/api.babelcloud.cn\/v1\/files', {\r\n        headers: { Authorization: `Bearer ${token}` }\r\n      });\r\n    }\r\n    throw err;\r\n  }\r\n}\r\n<\/code><\/pre>\n<h3>1.3 JWT\u4ee4\u724c\u7684\u5185\u90e8\u7ed3\u6784<\/h3>\n<p>\u4e91\u76d8\u8fd4\u56de\u7684JWT\u4ee4\u724c\u5305\u542b\u4e09\u4e2a\u90e8\u5206\uff1aHeader\u3001Payload\u3001Signature\u3002Payload\u4e2d\u5e94\u5305\u542b\u4ee5\u4e0b\u5173\u952e\u58f0\u660e\uff1a<\/p>\n<pre><code class=\"language-json\">{\r\n  &quot;iss&quot;: &quot;https:\/\/api.babelcloud.cn&quot;,\r\n  &quot;sub&quot;: &quot;app_7f3d2a9c1e8b4&quot;,      \/\/ \u5e94\u7528\u552f\u4e00\u6807\u8bc6\r\n  &quot;aud&quot;: [&quot;crm-system&quot;, &quot;erp-system&quot;], \/\/ \u6388\u6743\u8bbf\u95ee\u7684\u7cfb\u7edf\u5217\u8868\r\n  &quot;scope&quot;: &quot;file:read file:write folder:create&quot;,\r\n  &quot;exp&quot;: 1748601600,               \/\/ \u8fc7\u671f\u65f6\u95f4\uff08Unix\u65f6\u95f4\u6233\uff09\r\n  &quot;iat&quot;: 1748594400,               \/\/ \u7b7e\u53d1\u65f6\u95f4\r\n  &quot;jti&quot;: &quot;tok_unique_id_abc123&quot;    \/\/ \u4ee4\u724c\u552f\u4e00ID\uff0c\u7528\u4e8e\u9632\u91cd\u653e\r\n}\r\n<\/code><\/pre>\n<h3>1.4 \u6700\u5c0f\u6743\u9650\u539f\u5219\uff1aScope\u7cbe\u7ec6\u5316\u8bbe\u8ba1<\/h3>\n<p>\u4e0d\u8981\u7ed9\u4e0b\u6e38\u7cfb\u7edf\u5f00&#8221;\u8d85\u7ea7\u6743\u9650&#8221;\u3002\u5f88\u591a\u4f01\u4e1a\u96c6\u6210\u521d\u671f\u4e3a\u4e86\u5feb\u901f\u4e0a\u7ebf\uff0c\u4f1a\u7ed9\u7cfb\u7edf\u5f00\u653e<code>admin:all<\/code>\u6743\u9650\uff0c\u540e\u671f\u5c31\u6210\u4e86\u5b9a\u65f6\u70b8\u5f39\u2014\u2014CRM\u7cfb\u7edf\u88ab\u653b\u7834\u540e\uff0c\u653b\u51fb\u8005\u53ef\u4ee5\u8bbf\u95ee\u4f01\u4e1a\u6240\u6709\u6587\u4ef6\u3002<\/p>\n<p>\u5178\u578b\u7684Scope\u5206\u5c42\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>Scope<\/th>\n<th>\u6743\u9650\u8303\u56f4<\/th>\n<th>\u9002\u7528\u573a\u666f<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>file:read<\/code><\/td>\n<td>\u8bfb\u53d6\u6587\u4ef6\u5185\u5bb9\u548c\u5143\u6570\u636e<\/td>\n<td>\u6587\u6863\u9884\u89c8\u3001\u6570\u636e\u5206\u6790<\/td>\n<\/tr>\n<tr>\n<td><code>file:write<\/code><\/td>\n<td>\u4e0a\u4f20\u3001\u4fee\u6539\u3001\u5220\u9664\u6587\u4ef6<\/td>\n<td>\u5907\u4efd\u7cfb\u7edf\u3001\u5f52\u6863\u7cfb\u7edf<\/td>\n<\/tr>\n<tr>\n<td><code>folder:create<\/code><\/td>\n<td>\u521b\u5efa\u76ee\u5f55<\/td>\n<td>\u9879\u76ee\u521b\u5efa\u6d41\u7a0b<\/td>\n<\/tr>\n<tr>\n<td><code>admin:user<\/code><\/td>\n<td>\u7528\u6237\u7ba1\u7406<\/td>\n<td>HR\u7cfb\u7edf\u540c\u6b65<\/td>\n<\/tr>\n<tr>\n<td><code>admin:audit<\/code><\/td>\n<td>\u5ba1\u8ba1\u65e5\u5fd7\u8bfb\u53d6<\/td>\n<td>\u5b89\u5168\u5408\u89c4\u7cfb\u7edf<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u91cd\u8981\u5b9e\u8df5<\/strong>\uff1a\u751f\u4ea7\u73af\u5883\u4e2d\uff0cScope\u5e94\u7cbe\u786e\u5230\u6587\u4ef6\u8def\u5f84\u524d\u7f00\u3002\u4f8b\u5982\uff0c\u7ed9\u8d22\u52a1\u7cfb\u7edf\u53ea\u5f00\u653e <code>\/\u8d22\u52a1\u90e8\/<\/code> \u8def\u5f84\u4e0b\u7684\u8bfb\u5199\u6743\u9650\uff1a<\/p>\n<pre><code class=\"language-json\">{\r\n  &quot;scope&quot;: &quot;file:read file:write&quot;,\r\n  &quot;path_whitelist&quot;: [&quot;\/\u8d22\u52a1\u90e8\/*&quot;, &quot;\/\u5171\u4eab\u6587\u6863\/\u9884\u7b97\/*&quot;]\r\n}\r\n<\/code><\/pre>\n<hr \/>\n<h2>\u4e8c\u3001API\u8bbe\u8ba1\uff1aREST + Webhook \u7684\u804c\u8d23\u5206\u79bb<\/h2>\n<h3>2.1 \u540c\u6b65\u63a5\u53e3\uff1aRESTful\u7684\u6b63\u786e\u7528\u6cd5<\/h3>\n<p>\u4f01\u4e1a\u4e91\u76d8\u7684\u540c\u6b65\u63a5\u53e3\u627f\u62c5<strong>\u5373\u65f6\u67e5\u8be2\u548c\u64cd\u4f5c<\/strong>\u7684\u804c\u8d23\uff1a\u67e5\u8be2\u6587\u4ef6\u5217\u8868\u3001\u4e0a\u4f20\u6587\u4ef6\u3001\u83b7\u53d6\u4e0b\u8f7d\u94fe\u63a5\u3001\u4fee\u6539\u6743\u9650\u3002<\/p>\n<p>RESTful API\u8bbe\u8ba1\u6709\u4e09\u4e2a\u6838\u5fc3\u539f\u5219\uff1a<\/p>\n<p><strong>1. \u8d44\u6e90\u547d\u540d\u7528\u540d\u8bcd\uff0c\u4e0d\u662f\u52a8\u8bcd<\/strong><\/p>\n<pre><code>\u274c POST \/api\/downloadFile\r\n\u274c POST \/api\/getFileList\r\n\u2705 GET \/api\/files\/{fileId}\r\n\u2705 POST \/api\/files\r\n\u2705 PUT \/api\/files\/{fileId}\r\n<\/code><\/pre>\n<p><strong>2. \u4f7f\u7528HTTP\u65b9\u6cd5\u8868\u8fbe\u64cd\u4f5c\u8bed\u4e49<\/strong><\/p>\n<pre><code>GET    \/files\/{id}       \u2192 \u83b7\u53d6\u6587\u4ef6\u8be6\u60c5\r\nPOST   \/files            \u2192 \u4e0a\u4f20\u6587\u4ef6\r\nPUT    \/files\/{id}       \u2192 \u66f4\u65b0\u6587\u4ef6\u5143\u6570\u636e\r\nDELETE \/files\/{id}       \u2192 \u5220\u9664\u6587\u4ef6\r\nGET    \/files\/{id}\/acl   \u2192 \u83b7\u53d6\u6743\u9650\u5217\u8868\r\nPUT    \/files\/{id}\/acl   \u2192 \u66f4\u65b0\u6743\u9650\r\n<\/code><\/pre>\n<p><strong>3. \u7edf\u4e00\u7684\u9519\u8bef\u54cd\u5e94\u683c\u5f0f<\/strong><\/p>\n<p>\u6240\u6709\u9519\u8bef\u54cd\u5e94\u5fc5\u987b\u9075\u5faa\u7edf\u4e00\u7ed3\u6784\uff0c\u4fbf\u4e8e\u4e0b\u6e38\u7cfb\u7edf\u505a\u5f02\u5e38\u5904\u7406\uff1a<\/p>\n<pre><code class=\"language-json\">{\r\n  &quot;error&quot;: {\r\n    &quot;code&quot;: &quot;FILE_NOT_FOUND&quot;,\r\n    &quot;message&quot;: &quot;\u6587\u4ef6\u4e0d\u5b58\u5728\u6216\u65e0\u6743\u8bbf\u95ee&quot;,\r\n    &quot;details&quot;: {\r\n      &quot;file_id&quot;: &quot;f_8a7b6c5d4e3f&quot;,\r\n      &quot;path&quot;: &quot;\/\u9879\u76ee\u6587\u6863\/2024\/Q1\/\u6c47\u62a5.pptx&quot;\r\n    },\r\n    &quot;request_id&quot;: &quot;req_x9y8z7w6v5u4&quot;\r\n  }\r\n}\r\n<\/code><\/pre>\n<h3>2.2 \u5206\u9875\u4e0e\u8fc7\u6ee4\uff1a\u907f\u514d\u5927\u6587\u4ef6\u76ee\u5f55\u62d6\u57ae\u7cfb\u7edf<\/h3>\n<p>\u5f53\u6587\u4ef6\u76ee\u5f55\u5305\u542b\u6570\u4e07\u4e2a\u6587\u4ef6\u65f6\uff0c\u4e00\u6b21\u6027\u8fd4\u56de\u6240\u6709\u7ed3\u679c\u4f1a\u76f4\u63a5\u5bfc\u81f4\u8d85\u65f6\u6216\u5185\u5b58\u6ea2\u51fa\u3002\u5b9e\u6d4b\u8868\u660e\uff0c\u4e00\u4e2a\u5305\u542b3\u4e07\u6587\u4ef6\u7684\u76ee\u5f55\uff0c\u82e5\u4e0d\u52a0\u9650\u5236\u5730\u8fd4\u56de\u5168\u90e8\u6570\u636e\uff0c\u54cd\u5e94\u4f53\u5927\u5c0f\u901a\u5e38\u572850MB\u4ee5\u4e0a\uff0c\u4efb\u4f55\u4e0b\u6e38\u7cfb\u7edf\u90fd\u65e0\u6cd5\u6b63\u5e38\u5904\u7406\u3002<\/p>\n<p>\u6807\u51c6\u5206\u9875\u65b9\u6848\uff1a<\/p>\n<pre><code class=\"language-bash\"># \u6309\u4fee\u6539\u65f6\u95f4\u5012\u5e8f\uff0c\u6bcf\u6b21\u8fd4\u56de50\u6761\r\nGET \/api\/files?parent_id=folder_root&amp;sort=updated_at&amp;order=desc&amp;limit=50&amp;cursor=eyJpZCI6ImY_\r\n\r\n# \u54cd\u5e94\r\n{\r\n  &quot;data&quot;: [...],\r\n  &quot;pagination&quot;: {\r\n    &quot;has_more&quot;: true,\r\n    &quot;next_cursor&quot;: &quot;eyJpZCI6ImZfYWJjZGVmZyJ9&quot;,\r\n    &quot;total_count&quot;: 2847\r\n  }\r\n}\r\n<\/code><\/pre>\n<p><strong>\u63a8\u8350\u4f7f\u7528\u6e38\u6807\u5206\u9875\uff08Cursor Pagination\uff09<\/strong>\uff0c\u800c\u4e0d\u662f\u4f20\u7edf\u7684\u504f\u79fb\u91cf\u5206\u9875\uff08OFFSET\uff09\uff0c\u539f\u56e0\uff1a<\/p>\n<ul>\n<li>\u6587\u4ef6\u76ee\u5f55\u9891\u7e41\u53d8\u52a8\u65f6\uff0cOFFSET\u4f1a\u8df3\u884c\uff08\u6bd4\u5982\u5220\u9664\u4e86\u7b2c5\u6761\uff0cOFFSET 10\u4f1a\u8df3\u8fc7\u539f\u7b2c11\u6761\uff09<\/li>\n<li>\u6e38\u6807\u5206\u9875\u6027\u80fd\u7a33\u5b9a\uff0c\u4e0e\u76ee\u5f55\u603b\u5927\u5c0f\u65e0\u5173<\/li>\n<li>\u652f\u6301\u6df1\u5ea6\u5206\u9875\uff0c\u4e0d\u4f1a\u56e0\u4e3a\u4e2d\u95f4\u63d2\u5165\u65b0\u6587\u4ef6\u5bfc\u81f4\u91cd\u590d\u6216\u9057\u6f0f<\/li>\n<\/ul>\n<p>\u8fc7\u6ee4\u573a\u666f\u793a\u4f8b\u2014\u2014\u67e5\u627e\u8fc7\u53bb7\u5929\u5185\u4fee\u6539\u8fc7\u7684Excel\u6587\u4ef6\uff1a<\/p>\n<pre><code>GET \/api\/files?parent_id=folder_root&amp;file_type=xlsx&amp;updated_after=2026-04-22T00:00:00Z\r\n<\/code><\/pre>\n<h3>2.3 \u5f02\u6b65\u56de\u8c03\uff1aWebhook\u7684\u6b63\u786e\u6253\u5f00\u65b9\u5f0f<\/h3>\n<p>\u540c\u6b65API\u9002\u5408&#8221;\u67e5\u8be2-\u8fd4\u56de&#8221;\u7684\u5373\u65f6\u573a\u666f\uff0c\u4f46\u5f88\u591a\u4f01\u4e1a\u4e91\u76d8\u64cd\u4f5c\u7684\u8017\u65f6\u8fdc\u8d85\u7528\u6237\u7b49\u5f85\u9608\u503c\uff1a\u89c6\u9891\u8f6c\u7801\u3001\u5927\u6587\u4ef6\u5207\u7247\u4e0a\u4f20\u3001\u6279\u91cf\u6743\u9650\u53d8\u66f4\u3002\u8fd9\u4e9b\u573a\u666f\u9700\u8981<strong>\u5f02\u6b65Webhook\u901a\u77e5<\/strong>\u3002<\/p>\n<p>Webhook\u7684\u8bbe\u8ba1\u8981\u70b9\uff1a<\/p>\n<p><strong>1. \u4e8b\u4ef6\u7c7b\u578b\u8986\u76d6\u5b8c\u6574<\/strong><\/p>\n<pre><code class=\"language-json\">{\r\n  &quot;event&quot;: &quot;file.processed&quot;,\r\n  &quot;timestamp&quot;: &quot;2026-04-29T08:15:30Z&quot;,\r\n  &quot;data&quot;: {\r\n    &quot;file_id&quot;: &quot;f_9x8y7z6&quot;,\r\n    &quot;filename&quot;: &quot;\u4ea7\u54c1\u4ecb\u7ecd\u89c6\u9891.mp4&quot;,\r\n    &quot;output_formats&quot;: [&quot;mp4_1080p&quot;, &quot;mp4_720p&quot;, &quot;webm&quot;],\r\n    &quot;processing_duration_ms&quot;: 45230\r\n  }\r\n}\r\n<\/code><\/pre>\n<p><strong>2. \u4e8b\u4ef6\u5e42\u7b49\u6027\u5904\u7406<\/strong><\/p>\n<p>Webhook\u53ef\u80fd\u56e0\u7f51\u7edc\u95ee\u9898\u91cd\u590d\u6295\u9012\uff0c\u4e0b\u6e38\u7cfb\u7edf\u5fc5\u987b\u80fd\u5904\u7406\u91cd\u590d\u4e8b\u4ef6\u3002\u89e3\u51b3\u65b9\u6848\uff1a\u5229\u7528\u4e8b\u4ef6ID\u505a\u5e42\u7b49\uff1a<\/p>\n<pre><code class=\"language-javascript\">const processedEvents = new Set(); \/\/ \u751f\u4ea7\u73af\u5883\u5efa\u8bae\u7528Redis\r\n\r\nasync function handleWebhook(payload) {\r\n  const { event_id, event } = payload;\r\n\r\n  if (processedEvents.has(event_id)) {\r\n    console.log(`\u4e8b\u4ef6 ${event_id} \u5df2\u5904\u7406\uff0c\u8df3\u8fc7`);\r\n    return { status: 'duplicate', event_id };\r\n  }\r\n\r\n  \/\/ \u4e1a\u52a1\u903b\u8f91\r\n  await processEvent(event);\r\n\r\n  processedEvents.add(event_id);\r\n  return { status: 'processed', event_id };\r\n}\r\n<\/code><\/pre>\n<p><strong>3. \u7b7e\u540d\u9a8c\u8bc1\uff1a\u9632\u6b62\u4f2a\u9020\u8bf7\u6c42<\/strong><\/p>\n<p>\u4e91\u76d8\u670d\u52a1\u7aef\u5728\u53d1\u9001Webhook\u65f6\u4f1a\u5e26\u4e0a\u7b7e\u540d\uff0c\u4e0b\u6e38\u5fc5\u987b\u9a8c\u8bc1\uff1a<\/p>\n<pre><code class=\"language-javascript\">const crypto = require('crypto');\r\n\r\nfunction verifyWebhookSignature(payload, signature, secret) {\r\n  const expectedSig = crypto\r\n    .createHmac('sha256', secret)\r\n    .update(JSON.stringify(payload))\r\n    .digest('hex');\r\n\r\n  return crypto.timingSafeEqual(\r\n    Buffer.from(signature),\r\n    Buffer.from(`sha256=${expectedSig}`)\r\n  );\r\n}\r\n\r\n\/\/ Express\u4e2d\u95f4\u4ef6\u793a\u4f8b\r\napp.post('\/webhook', (req, res) =&gt; {\r\n  const signature = req.headers['x-cloud-signature'];\r\n\r\n  if (!verifyWebhookSignature(req.body, signature, process.env.WEBHOOK_SECRET)) {\r\n    return res.status(403).json({ error: 'Invalid signature' });\r\n  }\r\n\r\n  \/\/ \u5904\u7406\u4e8b\u4ef6...\r\n  res.status(200).json({ received: true });\r\n});\r\n<\/code><\/pre>\n<hr \/>\n<h2>\u4e09\u3001\u4e8b\u4ef6\u9a71\u52a8\u67b6\u6784\uff1a\u6d88\u606f\u961f\u5217\u7684\u9009\u578b\u4e0e\u5b9e\u8df5<\/h2>\n<h3>3.1 \u4e3a\u4ec0\u4e48\u8981\u5f15\u5165\u6d88\u606f\u961f\u5217\uff1f<\/h3>\n<p>\u76f4\u63a5Webhook\u8c03\u7528\u7684\u67b6\u6784\u5b58\u5728\u660e\u663e\u7f3a\u9677\uff1a<\/p>\n<ul>\n<li><strong>\u4e0b\u6e38\u7cfb\u7edf\u6302\u4e86<\/strong>\uff1a\u4e91\u76d8\u91cd\u8bd5\u51e0\u6b21\u540e\u653e\u5f03\uff0c\u4e8b\u4ef6\u4e22\u5931<\/li>\n<li><strong>\u4e0b\u6e38\u7cfb\u7edf\u5904\u7406\u6162<\/strong>\uff1a\u4e91\u76d8\u8d85\u65f6\uff0c\u4f46\u4e1a\u52a1\u5df2\u5b8c\u6210<\/li>\n<li><strong>\u591a\u4e2a\u4e0b\u6e38\u9700\u8981\u540c\u4e00\u4e8b\u4ef6<\/strong>\uff1aWebhook\u53ea\u80fd\u70b9\u5bf9\u70b9\u53d1\u9001<\/li>\n<\/ul>\n<p>\u5f15\u5165\u6d88\u606f\u961f\u5217\uff08\u5982RabbitMQ\u3001RocketMQ\uff09\u540e\uff0c\u67b6\u6784\u53d8\u4e3a\uff1a<\/p>\n<pre><code>\u4e91\u76d8\u7cfb\u7edf \u2192 \u6d88\u606f\u961f\u5217 \u2192 \u4e0b\u6e38\u6d88\u8d39\u8005\uff08CRM\/ERP\/OA\uff09\r\n                    \u2191\r\n                    \u2514\u2500\u2500 \u5ba1\u8ba1\u65e5\u5fd7\u7cfb\u7edf\uff08\u5355\u72ec\u6d88\u8d39\uff09\r\n<\/code><\/pre>\n<p>\u8fd9\u6837\u5b9e\u73b0\u4e86\u4e24\u5927\u7279\u6027\uff1a<\/p>\n<ol>\n<li><strong>\u53ef\u9760\u6295\u9012<\/strong>\uff1a\u6d88\u606f\u6301\u4e45\u5316\u5230\u78c1\u76d8\uff0c\u4e0b\u6e38\u5373\u4f7f\u91cd\u542f\u4e5f\u4e0d\u4f1a\u4e22\u6d88\u606f<\/li>\n<li><strong>\u4e00\u5bf9\u591a\u6d88\u8d39<\/strong>\uff1a\u540c\u4e00\u4e8b\u4ef6\u53ef\u88ab\u591a\u4e2a\u6d88\u8d39\u8005\u72ec\u7acb\u5904\u7406<\/li>\n<\/ol>\n<h3>3.2 \u4e8b\u4ef6\u7ed3\u6784\u8bbe\u8ba1<\/h3>\n<p>\u8bbe\u8ba1\u4e8b\u4ef6\u7ed3\u6784\u65f6\uff0c\u6709\u4e24\u4e2a\u6838\u5fc3\u539f\u5219\uff1a\u4e00\u662f\u4e8b\u4ef6\u5185\u5bb9\u8981\u81ea\u5305\u542b\uff08self-contained\uff09\uff0c\u6d88\u8d39\u8005\u4e0d\u9700\u8981\u518d\u53bb\u67e5\u5176\u4ed6\u63a5\u53e3\u5c31\u80fd\u5b8c\u6210\u5904\u7406\uff1b\u4e8c\u662f\u4e8b\u4ef6\u5143\u6570\u636e\u8981\u5b8c\u6574\uff0c\u4fbf\u4e8e\u95ee\u9898\u6392\u67e5\u548c\u94fe\u8def\u8ffd\u8e2a\u3002<\/p>\n<pre><code class=\"language-json\">{\r\n  &quot;event_id&quot;: &quot;evt_7f8e9d0a1b2c&quot;,\r\n  &quot;event_type&quot;: &quot;file.uploaded&quot;,\r\n  &quot;occurred_at&quot;: &quot;2026-04-29T08:30:00Z&quot;,\r\n  &quot;producer&quot;: &quot;babelcloud-storage-service&quot;,\r\n  &quot;schema_version&quot;: &quot;1.0&quot;,\r\n  &quot;data&quot;: {\r\n    &quot;file_id&quot;: &quot;f_1a2b3c4d&quot;,\r\n    &quot;filename&quot;: &quot;2024\u5e74Q1\u8d22\u52a1\u62a5\u544a.xlsx&quot;,\r\n    &quot;size_bytes&quot;: 4194304,\r\n    &quot;mime_type&quot;: &quot;application\/vnd.openxmlformats-officedocument.spreadsheetml.sheet&quot;,\r\n    &quot;uploader&quot;: {\r\n      &quot;user_id&quot;: &quot;u_9f8e7d6c&quot;,\r\n      &quot;username&quot;: &quot;zhangsan&quot;,\r\n      &quot;department&quot;: &quot;\u8d22\u52a1\u90e8&quot;\r\n    },\r\n    &quot;storage_path&quot;: &quot;\/\u8d22\u52a1\u90e8\/2024\/Q1\/\u62a5\u544a.xlsx&quot;,\r\n    &quot;checksum&quot;: &quot;sha256:a1b2c3d4e5f6...&quot;\r\n  },\r\n  &quot;metadata&quot;: {\r\n    &quot;correlation_id&quot;: &quot;corr_abc123&quot;,\r\n    &quot;source_ip&quot;: &quot;192.168.1.100&quot;\r\n  }\r\n}\r\n<\/code><\/pre>\n<h3>3.3 \u6d88\u8d39\u8005\u7684\u5e42\u7b49\u5904\u7406<\/h3>\n<p>\u6d88\u606f\u961f\u5217\u7684\u91cd\u8bd5\u673a\u5236\u53ef\u80fd\u5bfc\u81f4\u91cd\u590d\u6295\u9012\u3002\u4ee5\u4e0b\u662f\u5728\u6d88\u8d39\u8005\u7aef\u7684\u5e42\u7b49\u8bbe\u8ba1\uff1a<\/p>\n<pre><code class=\"language-javascript\">class FileEventConsumer {\r\n  constructor(messageQueue, fileService) {\r\n    this.queue = messageQueue;\r\n    this.fileService = fileService;\r\n  }\r\n\r\n  async processMessage(msg) {\r\n    const { event_id, event_type, data } = JSON.parse(msg.body);\r\n\r\n    \/\/ \u5e42\u7b49\u68c0\u67e5\uff1aRedis\u4e2d\u5b58\u50a8\u5df2\u5904\u7406\u4e8b\u4ef6ID\r\n    const isProcessed = await redis.get(`processed:${event_id}`);\r\n    if (isProcessed) {\r\n      console.log(`\u4e8b\u4ef6 ${event_id} \u5df2\u5904\u7406`);\r\n      this.queue.ack(msg);\r\n      return;\r\n    }\r\n\r\n    switch (event_type) {\r\n      case 'file.uploaded':\r\n        await this.handleFileUploaded(data);\r\n        break;\r\n      case 'file.deleted':\r\n        await this.handleFileDeleted(data);\r\n        break;\r\n      case 'file.shared':\r\n        await this.handleFileShared(data);\r\n        break;\r\n      default:\r\n        console.warn(`\u672a\u77e5\u4e8b\u4ef6\u7c7b\u578b: ${event_type}`);\r\n    }\r\n\r\n    \/\/ \u6807\u8bb0\u4e3a\u5df2\u5904\u7406\uff08\u8bbe\u7f6e24\u5c0f\u65f6\u8fc7\u671f\uff09\r\n    await redis.setex(`processed:${event_id}`, 86400, '1');\r\n    this.queue.ack(msg);\r\n  }\r\n}\r\n<\/code><\/pre>\n<h3>3.4 \u6b7b\u4fe1\u961f\u5217\u4e0e\u544a\u8b66<\/h3>\n<p>\u4efb\u4f55\u7cfb\u7edf\u90fd\u6709\u5931\u8d25\u7684\u6d88\u606f\uff0c\u8fd9\u662f\u4e0d\u53ef\u907f\u514d\u7684\u4e8b\u5b9e\u3002\u5982\u679c\u6d88\u606f\u5904\u7406\u8fde\u7eed\u5931\u8d253\u6b21\uff0c\u5e94\u8fdb\u5165\u6b7b\u4fe1\u961f\u5217\uff08DLQ\uff09\uff0c\u5e76\u89e6\u53d1\u544a\u8b66\uff1a<\/p>\n<pre><code class=\"language-yaml\"># RabbitMQ DLQ\u914d\u7f6e\u793a\u4f8b\r\nx-dead-letter-exchange: cloud-file.dlx\r\nx-dead-letter-routing-key: file-events.dlq\r\nx-message-ttl: 86400000  # 24\u5c0f\u65f6\u540e\u8fdb\u5165DLQ\r\n<\/code><\/pre>\n<p>\u544a\u8b66\u9608\u503c\u5efa\u8bae\uff1a<br \/>\n&#8211; DLQ\u6d88\u606f\u6570\u91cf &gt; 0 \u2192 \u7acb\u5373\u544a\u8b66\uff08\u8f7b\u5fae\uff09<br \/>\n&#8211; \u540c\u4e00\u6d88\u606f\u91cd\u8bd5\u6b21\u6570 &gt; 5 \u2192 \u544a\u8b66\uff08\u4e25\u91cd\uff09<br \/>\n&#8211; \u6d88\u606f\u5904\u7406\u5ef6\u8fdf &gt; 5\u5206\u949f \u2192 \u544a\u8b66\uff08\u6027\u80fd\u95ee\u9898\uff09<\/p>\n<hr \/>\n<h2>\u56db\u3001SDK\u96c6\u6210\uff1a\u4ece\u5165\u95e8\u5230\u751f\u4ea7\u7ea7\u5b9e\u8df5<\/h2>\n<h3>4.1 \u5b98\u65b9SDK vs \u81ea\u5b9a\u4e49\u5c01\u88c5<\/h3>\n<p>\u4e3b\u6d41\u4f01\u4e1a\u4e91\u76d8\u5382\u5546\uff08\u5df4\u522b\u9e1f\u3001Box\u3001SharePoint\u7b49\uff09\u5747\u63d0\u4f9b\u5b98\u65b9SDK\u3002\u4ee5\u5df4\u522b\u9e1f\u5b98\u65b9Node.js SDK\u4e3a\u4f8b\uff1a<\/p>\n<pre><code class=\"language-javascript\">const BabelCloud = require('@babelcloud\/sdk');\r\n\r\nconst client = new BabelCloud({\r\n  clientId: process.env.BABEL_CLIENT_ID,\r\n  clientSecret: process.env.BABEL_CLIENT_SECRET,\r\n  baseUrl: 'https:\/\/api.babelcloud.cn'\r\n});\r\n\r\n\/\/ \u4e0a\u4f20\u6587\u4ef6\uff08\u81ea\u52a8\u5904\u7406\u5206\u7247\uff09\r\nasync function uploadFile(folderId, filePath) {\r\n  const stats = require('fs').statSync(filePath);\r\n\r\n  \/\/ \u5c0f\u6587\u4ef6\u76f4\u63a5\u4e0a\u4f20\r\n  if (stats.size &lt; 10 * 1024 * 1024) { \/\/ &lt; 10MB\r\n    return await client.files.upload({\r\n      parent_id: folderId,\r\n      file: filePath\r\n    });\r\n  }\r\n\r\n  \/\/ \u5927\u6587\u4ef6\u5206\u7247\u4e0a\u4f20\uff08\u81ea\u52a8\u5206\u7247\u3001\u81ea\u52a8\u91cd\u8bd5\u3001\u81ea\u52a8\u65ad\u70b9\u7eed\u4f20\uff09\r\n  return await client.files.uploadLarge({\r\n    parent_id: folderId,\r\n    file: filePath,\r\n    chunkSize: 5 * 1024 * 1024,  \/\/ 5MB\u5206\u7247\r\n    onProgress: (uploaded, total) =&gt; {\r\n      console.log(`\u4e0a\u4f20\u8fdb\u5ea6: ${Math.round(uploaded\/total*100)}%`);\r\n    }\r\n  });\r\n}\r\n<\/code><\/pre>\n<h3>4.2 \u8fde\u63a5\u6c60\u4e0e\u7194\u65ad\u673a\u5236<\/h3>\n<p>\u751f\u4ea7\u73af\u5883\u4e2d\uff0cSDK\u7684HTTP\u5ba2\u6237\u7aef\u5fc5\u987b\u914d\u7f6e\u8fde\u63a5\u6c60\u53c2\u6570\uff0c\u5426\u5219\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u4f1a\u8017\u5c3d\u7cfb\u7edf\u6587\u4ef6\u63cf\u8ff0\u7b26\u3002\u5b9e\u6d4b\u6570\u636e\u663e\u793a\uff0c\u5355\u8fdb\u7a0b\u4e0d\u505a\u8fde\u63a5\u6c60\u9650\u5236\u65f6\uff0c200\u5e76\u53d1\u8bf7\u6c42\u5c31\u80fd\u8017\u5c3dLinux\u9ed8\u8ba4\u76841024\u6587\u4ef6\u63cf\u8ff0\u7b26\u9650\u5236\uff0c\u5bfc\u81f4&#8221;Too many open files&#8221;\u9519\u8bef\u3002<\/p>\n<p>\u63a8\u8350\u914d\u7f6e\uff1a<\/p>\n<pre><code class=\"language-javascript\">const client = new BabelCloud({\r\n  \/\/ ...\r\n  httpAgent: new Agent({\r\n    maxSockets: 100,        \/\/ \u6bcf\u4e2ahost\u6700\u5927\u5e76\u53d1\u8fde\u63a5\u6570\r\n    maxFreeSockets: 10,     \/\/ \u7a7a\u95f2\u8fde\u63a5\u4fdd\u7559\u6570\r\n    timeout: 30000,         \/\/ 30\u79d2\u8d85\u65f6\r\n    keepAlive: true\r\n  })\r\n});\r\n<\/code><\/pre>\n<p>\u7194\u65ad\u5668\uff08Circuit Breaker\uff09\u9632\u6b62\u4e0b\u6e38\u6545\u969c\u62d6\u57ae\u4e0a\u6e38\u7cfb\u7edf\uff1a<\/p>\n<pre><code class=\"language-javascript\">const CircuitBreaker = require('opossum');\r\n\r\nconst breaker = new CircuitBreaker(async (fileId) =&gt; {\r\n  return await client.files.get(fileId);\r\n}, {\r\n  timeout: 3000,           \/\/ 3\u79d2\u4e0d\u8fd4\u56de\u5c31\u7b97\u5931\u8d25\r\n  errorThresholdPercentage: 50, \/\/ 50%\u5931\u8d25\u7387\u89e6\u53d1\u7194\u65ad\r\n  resetTimeout: 30000      \/\/ 30\u79d2\u540e\u534a\u5f00\u5c1d\u8bd5\u6062\u590d\r\n});\r\n\r\nbreaker.on('open', () =&gt; {\r\n  console.error('\u7535\u8def\u7194\u65ad\u6253\u5f00\uff1a\u4e91\u76d8API\u6682\u65f6\u4e0d\u53ef\u7528');\r\n  metrics.increment('circuit_breaker.open');\r\n});\r\n\r\nbreaker.on('halfOpen', () =&gt; {\r\n  console.log('\u7535\u8def\u7194\u65ad\u534a\u5f00\uff1a\u5c1d\u8bd5\u6062\u590d\u8fde\u63a5');\r\n});\r\n\r\n\/\/ \u4f7f\u7528\u7194\u65ad\u5668\u5305\u88c5API\u8c03\u7528\r\nconst file = await breaker.fire(fileId);\r\n<\/code><\/pre>\n<h3>4.3 \u96c6\u6210\u6d4b\u8bd5\u7684\u8981\u70b9<\/h3>\n<p>SDK\u96c6\u6210\u6d4b\u8bd5\u4e0d\u80fd\u53ea\u6d4b&#8221;happy path&#8221;\uff0c\u5fc5\u987b\u8986\u76d6\u5f02\u5e38\u573a\u666f\uff1a<\/p>\n<pre><code class=\"language-javascript\">describe('\u6587\u4ef6\u4e0a\u4f20SDK\u6d4b\u8bd5', () =&gt; {\r\n  it('\u6b63\u5e38\u4e0a\u4f2010MB\u6587\u4ef6', async () =&gt; {\r\n    const result = await uploadFile(testFolderId, '.\/fixtures\/test_10mb.pdf');\r\n    expect(result.id).toMatch(\/^f_[a-z0-9]+$\/);\r\n  });\r\n\r\n  it('\u8d85\u5927\u6587\u4ef6\uff085GB\uff09\u5206\u7247\u4e0a\u4f20\u6210\u529f', async () =&gt; {\r\n    const result = await uploadFile(testFolderId, '.\/fixtures\/test_5gb.zip');\r\n    expect(result.size).toBe(5368709120);\r\n  }, 300000); \/\/ 5GB\u6587\u4ef6\u6d4b\u8bd5\u8d85\u65f6\u65f6\u95f4\u8bbe\u4e3a5\u5206\u949f\r\n\r\n  it('\u4e0a\u4f20\u65f6\u7f51\u7edc\u4e2d\u65ad\uff0c\u81ea\u52a8\u91cd\u8bd53\u6b21', async () =&gt; {\r\n    \/\/ \u4f7f\u7528nock\u6a21\u62df\u7f51\u7edc\u4e2d\u65ad\r\n    nock('https:\/\/api.babelcloud.cn')\r\n      .post('\/v1\/files\/upload')\r\n      .times(3)\r\n      .reply(500, 'Server Error')\r\n      .post('\/v1\/files\/upload')\r\n      .reply(200, { id: 'f_recovered' });\r\n\r\n    const result = await uploadFile(testFolderId, '.\/fixtures\/small.pdf');\r\n    expect(result.id).toBe('f_recovered');\r\n  });\r\n\r\n  it('\u6587\u4ef6\u5df2\u5b58\u5728\u65f6\u8fd4\u56de409\u51b2\u7a81\u9519\u8bef', async () =&gt; {\r\n    await expect(\r\n      uploadFile(existingFolderId, '.\/fixtures\/duplicate.pdf')\r\n    ).rejects.toMatchObject({\r\n      code: 'FILE_ALREADY_EXISTS'\r\n    });\r\n  });\r\n});\r\n<\/code><\/pre>\n<hr \/>\n<h2>\u4e94\u3001\u67b6\u6784\u56fe\uff1a\u5b8c\u6574\u7684\u96c6\u6210\u5168\u666f<\/h2>\n<pre><code>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\r\n\u2502                        \u4e0b\u6e38\u4e1a\u52a1\u7cfb\u7edf                          \u2502\r\n\u2502   \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510   \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510   \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510   \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510  \u2502\r\n\u2502   \u2502  CRM\u7cfb\u7edf  \u2502   \u2502  ERP\u7cfb\u7edf  \u2502   \u2502  OA\u7cfb\u7edf  \u2502   \u2502 \u6570\u636e\u5206\u6790  \u2502  \u2502\r\n\u2502   \u2514\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2518   \u2514\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2518   \u2514\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2518   \u2514\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2518  \u2502\r\n\u2502        \u2502              \u2502              \u2502              \u2502       \u2502\r\n\u2502   \u250c\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2510  \u2502\r\n\u2502   \u2502                    SDK \/ REST Client                 \u2502  \u2502\r\n\u2502   \u2502         (OAuth2 + JWT \/ \u8fde\u63a5\u6c60 \/ \u7194\u65ad\u5668)              \u2502  \u2502\r\n\u2502   \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518  \u2502\r\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\r\n                               \u2502\r\n                    HTTPS + OAuth2 Bearer Token\r\n                               \u2502\r\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\r\n\u2502                      \u5df4\u522b\u9e1f\u4f01\u4e1a\u4e91\u76d8 API Gateway               \u2502\r\n\u2502   \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510   \u2502\r\n\u2502   \u2502            \u7edf\u4e00\u5165\u53e3\uff1a\u8ba4\u8bc1\u3001\u9650\u6d41\u3001\u65e5\u5fd7\u3001\u76d1\u63a7            \u2502   \u2502\r\n\u2502   \u2514\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2518   \u2502\r\n\u2502        \u2502            \u2502              \u2502              \u2502         \u2502\r\n\u2502   \u250c\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2510  \u250c\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2510  \u250c\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2510  \u250c\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2510    \u2502\r\n\u2502   \u2502\u6587\u4ef6\u670d\u52a1  \u2502  \u2502\u6743\u9650\u670d\u52a1  \u2502  \u2502  \u7528\u6237\u670d\u52a1  \u2502  \u2502 \u5ba1\u8ba1\u670d\u52a1 \u2502    \u2502\r\n\u2502   \u2514\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2518  \u2514\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2518  \u2514\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2518  \u2514\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2518    \u2502\r\n\u2502        \u2502            \u2502              \u2502              \u2502         \u2502\r\n\u2502   \u250c\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2510    \u2502\r\n\u2502   \u2502              Kafka \/ RocketMQ \u6d88\u606f\u603b\u7ebf              \u2502    \u2502\r\n\u2502   \u2514\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2518    \u2502\r\n\u2502        \u2502          \u4e8b\u4ef6\u9a71\u52a8\uff1aWebhook \/ \u6d88\u606f\u961f\u5217         \u2502       \u2502\r\n\u2502   \u250c\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2510  \u2502\r\n\u2502   \u2502              \u4e0b\u6e38\u6d88\u8d39\u8005\uff08\u5f02\u6b65\u5904\u7406\uff09                      \u2502  \u2502\r\n\u2502   \u2502   - \u75c5\u6bd2\u626b\u63cf\u670d\u52a1  - \u5168\u6587\u68c0\u7d22\u7d22\u5f15  - \u5ba1\u8ba1\u65e5\u5fd7\u5b58\u6863          \u2502  \u2502\r\n\u2502   \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518  \u2502\r\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\r\n<\/code><\/pre>\n<hr \/>\n<h2>\u4e94\u3001\u5e38\u89c1\u8e29\u5751\u4e0e\u907f\u5751\u6307\u5357<\/h2>\n<h3>5.1 \u4ee4\u724c\u7f13\u5b58\u5f15\u53d1\u7684\u6743\u9650\u5e7d\u7075<\/h3>\n<p>\u67d0\u4f01\u4e1a\u5728\u96c6\u6210\u6d4b\u8bd5\u65f6\u53d1\u73b0\uff1a\u8d22\u52a1\u7cfb\u7edf\u7684\u65b0\u5458\u5de5\u660e\u660e\u5df2\u88ab\u79fb\u9664\uff0c\u4f46\u7cfb\u7edf\u4ecd\u7136\u80fd\u8bbf\u95ee\u8d22\u52a1\u90e8\u6587\u4ef6\u3002\u6392\u67e5\u540e\u53d1\u73b0\uff0c\u95ee\u9898\u51fa\u5728\u4ee4\u724c\u7684\u7f13\u5b58\u7b56\u7565\u4e0a\u2014\u2014\u4e0b\u6e38\u7cfb\u7edf\u5c06OAuth2\u4ee4\u724c\u7f13\u5b58\u4e8624\u5c0f\u65f6\uff0c\u4f46\u4e91\u76d8\u4fa7\u57284\u5c0f\u65f6\u524d\u5c31\u5df2\u7ecf\u6536\u56de\u4e86\u8be5\u5e94\u7528\u7684\u8bbf\u95ee\u6743\u9650\u3002<\/p>\n<p><strong>\u907f\u5751\u65b9\u6848<\/strong>\uff1a\u4ee4\u724c\u6709\u6548\u671f\u5e94\u4e0e\u670d\u52a1\u7aefTTL\u4fdd\u6301\u4e00\u81f4\uff0c\u5efa\u8bae\u5ba2\u6237\u7aef\u7f13\u5b58\u65f6\u95f4\u4e0d\u8d85\u8fc7\u670d\u52a1\u7aefTTL\u768480%\u3002\u66f4\u7a33\u59a5\u7684\u505a\u6cd5\u662f\u4e3b\u52a8\u8ba2\u9605\u6743\u9650\u53d8\u66f4\u4e8b\u4ef6\uff08<code>app.permission_revoked<\/code>\uff09\uff0c\u5728\u6743\u9650\u56de\u6536\u65f6\u7acb\u5373\u6e05\u9664\u672c\u5730\u7f13\u5b58\u3002<\/p>\n<pre><code class=\"language-javascript\">\/\/ \u4e3b\u52a8\u76d1\u542c\u6743\u9650\u53d8\u66f4\u4e8b\u4ef6\r\nwebsocket.on('permission_changed', (event) =&gt; {\r\n  if (event.action === 'revoked' &amp;&amp; event.client_id === currentClientId) {\r\n    \/\/ \u7acb\u5373\u6e05\u9664\u4ee4\u724c\u7f13\u5b58\uff0c\u5f3a\u5236\u91cd\u65b0\u8ba4\u8bc1\r\n    tokenCache.invalidate(currentClientId);\r\n  }\r\n});\r\n<\/code><\/pre>\n<h3>5.2 \u5927\u6587\u4ef6\u5206\u7247\u4e0a\u4f20\u7684\u8fdb\u5ea6\u4e22\u5931<\/h3>\n<p>\u8d85\u8fc7100MB\u7684\u6587\u4ef6\u901a\u5e38\u9700\u8981\u5206\u7247\u4e0a\u4f20\uff0c\u4f46\u5982\u679c\u5728\u4e0a\u4f20\u5230\u7b2c7\u7247\u65f6\u7f51\u7edc\u4e2d\u65ad\uff0c\u5f88\u591aSDK\u9ed8\u8ba4\u4f1a\u4ece\u5934\u5f00\u59cb\u91cd\u4f20\uff0c\u800c\u4e0d\u662f\u4ece\u65ad\u70b9\u7ee7\u7eed\u3002\u8fd9\u4e0d\u4ec5\u6d6a\u8d39\u5e26\u5bbd\uff0c\u8fd8\u4f1a\u5bfc\u81f4\u4e0a\u4f20\u8d85\u65f6\u3002<\/p>\n<p><strong>\u907f\u5751\u65b9\u6848<\/strong>\uff1a\u9009\u7528\u652f\u6301\u65ad\u70b9\u7eed\u4f20\u548c\u5206\u7247\u5e76\u53d1\u7684SDK\u3002\u5df4\u522b\u9e1fSDK\u7684\u5206\u7247\u4e0a\u4f20\u652f\u6301\u591a\u7247\u5e76\u53d1\uff08\u9ed8\u8ba43\u7247\u5e76\u53d1\uff0c\u4e0a\u4f20\u901f\u5ea6\u63d0\u5347\u660e\u663e\uff09\uff0c\u4e14\u6bcf\u7247\u4e0a\u4f20\u6210\u529f\u540e\u4f1a\u5728\u672c\u5730\u8bb0\u5f55\u8fdb\u5ea6\uff0c\u7f51\u7edc\u6062\u590d\u540e\u81ea\u52a8\u4ece\u65ad\u70b9\u7ee7\u7eed\uff1a<\/p>\n<pre><code class=\"language-javascript\">const result = await client.files.uploadLarge({\r\n  parent_id: folderId,\r\n  file: '.\/large_video.mp4',\r\n  chunkSize: 5 * 1024 * 1024,      \/\/ 5MB\u5206\u7247\r\n  concurrency: 3,                   \/\/ 3\u7247\u5e76\u53d1\u4e0a\u4f20\r\n  resumeThreshold: 0.8,             \/\/ \u4e0a\u4f2080%\u540e\u9047\u5230\u4e2d\u65ad\uff0c\u4f18\u5148\u91cd\u8bd5\u672a\u5b8c\u6210\u5206\u7247\r\n  onChunkComplete: (chunkIndex, total) =&gt; {\r\n    console.log(`\u5206\u7247 ${chunkIndex + 1}\/${total} \u4e0a\u4f20\u5b8c\u6210`);\r\n  }\r\n});\r\n<\/code><\/pre>\n<h3>5.3 Webhook\u91cd\u590d\u4e8b\u4ef6\u6253\u7206\u4e0b\u6e38<\/h3>\n<p>\u67d0\u4e9b\u6d88\u606f\u961f\u5217\uff08\u5982Kafka\uff09\u5728\u6d88\u8d39\u8005 group rebalance\u65f6\u4f1a\u4ea7\u751f\u91cd\u590d\u6295\u9012\uff0c\u5b9e\u6d4b\u4e2d\u4e00\u4e2a\u6587\u4ef6\u4e0a\u4f20\u4e8b\u4ef6\u88ab\u6295\u9012\u4e867\u6b21\u3002\u4e0b\u6e38\u5982\u679c\u6ca1\u6709\u5e42\u7b49\u4fdd\u62a4\uff0cCRM\u7cfb\u7edf\u5c31\u4f1a\u521b\u5efa7\u6761\u91cd\u590d\u7684\u9644\u4ef6\u8bb0\u5f55\u3002<\/p>\n<p><strong>\u907f\u5751\u65b9\u6848<\/strong>\uff1a\u5728\u6570\u636e\u5e93\u5c42\u9762\u5efa\u7acb\u552f\u4e00\u7ea6\u675f\uff0c\u540c\u65f6\u5728\u5e42\u7b49\u8868\u4e2d\u8bb0\u5f55\u4e8b\u4ef6ID\u548c\u4e1a\u52a1\u4e3b\u952e\u7684\u6620\u5c04\u5173\u7cfb\uff1a<\/p>\n<pre><code class=\"language-sql\">CREATE UNIQUE INDEX idx_idempotency_event \r\nON file_events_processed(event_id);\r\n\r\n-- \u4e1a\u52a1\u903b\u8f91\r\nINSERT INTO file_attachments (file_id, event_id, filename) \r\nVALUES ($1, $2, $3) \r\nON CONFLICT (event_id) DO NOTHING;\r\n<\/code><\/pre>\n<hr \/>\n<h2>\u516d\u3001\u9650\u6d41\u4e0e\u914d\u989d\uff1a\u4fdd\u62a4\u5e73\u53f0\u4e0d\u88ab\u62d6\u57ae<\/h2>\n<p>\u5f00\u653eAPI\u7684\u6700\u5927\u98ce\u9669\u4e4b\u4e00\u662f\u4e0b\u6e38\u7cfb\u7edf\u5931\u63a7\u2014\u2014\u67d0\u4e2a\u5b9a\u65f6\u4efb\u52a1\u6b7b\u5faa\u73af\u3001\u67d0\u4e2a\u5f00\u53d1\u73af\u5883\u5360\u6ee1\u5e26\u5bbd\u3001\u67d0\u4e2a\u7cfb\u7edf\u88ab\u6076\u610f\u8c03\u7528\u3002\u9650\u6d41\uff08Rate Limiting\uff09\u548c\u914d\u989d\uff08Quota\uff09\u662fAPI\u7f51\u5173\u7684\u4e24\u9053\u5b89\u5168\u95f8\u3002<\/p>\n<h3>6.1 \u9650\u6d41\u7b97\u6cd5\u9009\u578b<\/h3>\n<p>\u5e38\u7528\u9650\u6d41\u7b97\u6cd5\u6709\u4e09\u79cd\uff1a\u56fa\u5b9a\u7a97\u53e3\u3001\u6ed1\u52a8\u7a97\u53e3\u3001\u4ee4\u724c\u6876\u3002\u56fa\u5b9a\u7a97\u53e3\u5b9e\u73b0\u7b80\u5355\u4f46\u6709\u4e34\u754c\u95ee\u9898\uff08\u7a97\u53e3\u5207\u6362\u65f6\u53ef\u80fd\u51fa\u73b02\u500d\u7a81\u53d1\uff09\uff0c\u4ee4\u724c\u6876\u662f\u751f\u4ea7\u73af\u5883\u9996\u9009\u3002<\/p>\n<pre><code class=\"language-nginx\"># Nginx\u9650\u6d41\u914d\u7f6e\u793a\u4f8b\uff08\u4ee4\u724c\u6876\uff09\r\nlimit_req_zone $binary_remote_addr zone=api_limit:10m rate=100r\/s;\r\n\r\nlocation \/api\/ {\r\n    limit_req zone=api_limit burst=200 nodelay;\r\n    proxy_pass http:\/\/babelcloud_backend;\r\n}\r\n<\/code><\/pre>\n<h3>6.2 \u591a\u7ef4\u5ea6\u914d\u989d\u8bbe\u8ba1<\/h3>\n<p>\u9664\u4e86\u63a5\u53e3\u7ea7\u522b\u7684\u9650\u6d41\uff0c\u8fd8\u9700\u8981\u7ed9\u6bcf\u4e2a\u5e94\u7528\u8bbe\u7f6e\u65e5\/\u6708\u914d\u989d\u4e0a\u9650\uff0c\u9632\u6b62\u5355\u4e00\u5e94\u7528\u8017\u5c3d\u5e73\u53f0\u8d44\u6e90\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>\u914d\u989d\u7ef4\u5ea6<\/th>\n<th>\u666e\u901a\u5e94\u7528<\/th>\n<th>\u4f01\u4e1a\u5e94\u7528<\/th>\n<th>\u8d85\u9650\u5904\u7406<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u6bcf\u5206\u949f\u8bf7\u6c42\u6570<\/td>\n<td>300<\/td>\n<td>3000<\/td>\n<td>\u8fd4\u56de429<\/td>\n<\/tr>\n<tr>\n<td>\u6bcf\u65e5\u4e0a\u4f20\u6d41\u91cf<\/td>\n<td>10GB<\/td>\n<td>100GB<\/td>\n<td>\u8fd4\u56de413<\/td>\n<\/tr>\n<tr>\n<td>\u6bcf\u6708API\u8c03\u7528<\/td>\n<td>10\u4e07\u6b21<\/td>\n<td>\u65e0\u9650<\/td>\n<td>\u2014<\/td>\n<\/tr>\n<tr>\n<td>\u5e76\u53d1\u8fde\u63a5\u6570<\/td>\n<td>20<\/td>\n<td>200<\/td>\n<td>\u8fd4\u56de503<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre><code class=\"language-json\">\/\/ \u914d\u989d\u8d85\u9650\u65f6\u7684\u6807\u51c6\u54cd\u5e94\r\n{\r\n  &quot;error&quot;: {\r\n    &quot;code&quot;: &quot;QUOTA_EXCEEDED&quot;,\r\n    &quot;message&quot;: &quot;\u6bcf\u65e5\u4e0a\u4f20\u6d41\u91cf\u5df2\u8fbe\u4e0a\u9650\uff0810GB\uff09\uff0c\u8bf7\u660e\u65e5\u518d\u8bd5\u6216\u5347\u7ea7\u4f01\u4e1a\u7248&quot;,\r\n    &quot;details&quot;: {\r\n      &quot;quota_type&quot;: &quot;daily_upload_bytes&quot;,\r\n      &quot;limit&quot;: 10737418240,\r\n      &quot;used&quot;: 10737418240,\r\n      &quot;resets_at&quot;: &quot;2026-04-30T00:00:00Z&quot;\r\n    }\r\n  }\r\n}\r\n<\/code><\/pre>\n<h3>6.3 \u4e0b\u6e38\u7684\u5e94\u5bf9\u7b56\u7565<\/h3>\n<p>\u5f53\u4e0b\u6e38\u7cfb\u7edf\u6536\u5230429\uff08Too Many Requests\uff09\u54cd\u5e94\u65f6\uff0c\u5e94\u8be5\u5b9e\u73b0\u6307\u6570\u9000\u907f\u91cd\u8bd5\uff0c\u800c\u4e0d\u662f\u75af\u72c2\u91cd\u8bd5\uff1a<\/p>\n<pre><code class=\"language-javascript\">async function callApiWithRetry(apiFunc, maxRetries = 5) {\r\n  for (let attempt = 0; attempt &lt; maxRetries; attempt++) {\r\n    try {\r\n      return await apiFunc();\r\n    } catch (err) {\r\n      if (err.response?.status === 429) {\r\n        \/\/ \u8bfb\u53d6Retry-After\u5934\uff0c\u5982\u679c\u6ca1\u6709\u5219\u7528\u6307\u6570\u9000\u907f\r\n        const retryAfter = err.response.headers['retry-after'];\r\n        const waitMs = retryAfter \r\n          ? parseInt(retryAfter) * 1000 \r\n          : Math.min(1000 * Math.pow(2, attempt), 30000);\r\n\r\n        console.log(`\u9650\u6d41\uff0c${waitMs}ms\u540e\u7b2c${attempt + 1}\u6b21\u91cd\u8bd5...`);\r\n        await new Promise(resolve =&gt; setTimeout(resolve, waitMs));\r\n        continue;\r\n      }\r\n      throw err;\r\n    }\r\n  }\r\n  throw new Error(`\u91cd\u8bd5${maxRetries}\u6b21\u540e\u4ecd\u5931\u8d25`);\r\n}\r\n<\/code><\/pre>\n<hr \/>\n<h2>\u7ed3\u8bed<\/h2>\n<p>\u4f01\u4e1a\u4e91\u76d8API\u96c6\u6210\u4e0d\u662f\u4e00\u4e2a&#8221;\u8c03\u901a\u5c31\u884c&#8221;\u7684\u7b80\u5355\u4efb\u52a1\u3002\u4eceOAuth2\u4ee4\u724c\u7684\u7cbe\u7ec6\u5316Scope\u8bbe\u8ba1\uff0c\u5230RESTful\u63a5\u53e3\u7684\u5206\u9875\u4f18\u5316\uff0c\u518d\u5230\u4e8b\u4ef6\u9a71\u52a8\u7684\u6d88\u606f\u961f\u5217\u67b6\u6784\uff0c\u6bcf\u4e2a\u73af\u8282\u90fd\u9700\u8981\u8003\u8651\u53ef\u9760\u6027\u3001\u5b89\u5168\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n<p><strong>\u4e09\u4e2a\u6838\u5fc3\u539f\u5219<\/strong>\u8d2f\u7a7f\u5168\u6587\uff1a<\/p>\n<ol>\n<li><strong>\u6700\u5c0f\u6743\u9650<\/strong>\uff1a\u6c38\u8fdc\u4e0d\u8981\u7ed9\u4e0b\u6e38\u7cfb\u7edf\u8d85\u51fa\u5176\u4e1a\u52a1\u9700\u6c42\u7684\u6743\u9650<\/li>\n<li><strong>\u5e42\u7b49\u8bbe\u8ba1<\/strong>\uff1a\u7f51\u7edc\u4e0d\u53ef\u9760\u662f\u5e38\u6001\uff0c\u91cd\u590d\u5904\u7406\u662f\u5fc5\u7136\uff0c\u5e42\u7b49\u662f\u89e3\u51b3\u65b9\u6848<\/li>\n<li><strong>\u7194\u65ad\u4fdd\u62a4<\/strong>\uff1a\u4e0b\u6e38\u7cfb\u7edf\u7684\u6545\u969c\u4e0d\u5e94\u7ea7\u8054\u5230\u4e0a\u6e38\uff0c\u66f4\u4e0d\u5e94\u62d6\u57ae\u6574\u4e2a\u5e73\u53f0<\/li>\n<\/ol>\n<p>\u505a\u597d\u8fd9\u4e09\u70b9\uff0c\u4f01\u4e1a\u4e91\u76d8API\u96c6\u6210\u4ece&#8221;\u80fd\u7528&#8221;\u5230&#8221;\u597d\u7528&#8221;\u4e4b\u95f4\u7684\u8ddd\u79bb\u5c31\u4e0d\u8fdc\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u4f01\u4e1a\u6570\u5b57\u5316\u8f6c\u578b\u6d6a\u6f6e\u4e2d\uff0c\u4f01\u4e1a\u4e91\u76d8\u65e9\u5df2\u4ece\u7b80\u5355\u7684\u6587\u4ef6\u5b58\u50a8\u5de5\u5177\u6f14\u53d8&#8230; <a class=\"read-more\" href=\"https:\/\/www.babel.cc\/blog\/?p=6677\">[Continue Reading]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-6677","post","type-post","status-publish","format-standard","hentry","category-2","no-post-thumbnail"],"_links":{"self":[{"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6677","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6677"}],"version-history":[{"count":1,"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6677\/revisions"}],"predecessor-version":[{"id":6678,"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6677\/revisions\/6678"}],"wp:attachment":[{"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6677"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}