{"id":1946,"date":"2018-11-29T18:18:17","date_gmt":"2018-11-29T10:18:17","guid":{"rendered":"http:\/\/www.storagelab.org.cn\/zhangdi\/?p=1946"},"modified":"2018-11-29T18:18:17","modified_gmt":"2018-11-29T10:18:17","slug":"restful-api%e7%9a%84%e5%ae%9e%e8%b7%b5%e6%80%bb%e7%bb%93","status":"publish","type":"post","link":"https:\/\/www.divis.cn\/index.php\/2018\/11\/29\/restful-api%e7%9a%84%e5%ae%9e%e8%b7%b5%e6%80%bb%e7%bb%93\/","title":{"rendered":"restful api\u7684\u5b9e\u8df5\u603b\u7ed3"},"content":{"rendered":"<p>\u6211\u6700\u65e9\u63a5\u89e6RESTful API\u8fd9\u4e2a\u4e1c\u897f\uff0c\u662f2011\u5e74\u521d\u5728\u4e2d\u56fd\u4f20\u5a92\u5927\u5b66\u8bfb\u7814\u7684\u65f6\u5019\uff0c\u4e00\u8d77\u505a\u9879\u76ee\u7684\u540c\u5b66\u4faf\u632f\u5b87\u544a\u8bc9\u6211\u7684\u3002\u5230\u73b0\u5728\u5df2\u7ecf7\u5e74\u4e86\u3002\u4f5c\u4e3a\u4e00\u79cd\u8bbe\u8ba1\u98ce\u683c\uff0cRESTful\u73b0\u5728\u4f9d\u7136\u5f88\u6d41\u884c\u3002\u5728\u5e26\u5b66\u751f\u505a\u53ef\u89c6\u5206\u6790\u7cfb\u7edf\u7684\u65f6\u5019\uff0c\u6211\u4eec\u4f9d\u7136\u5728\u91c7\u7528\u8fd9\u79cd\u6a21\u5f0f\u3002\u4e0d\u8fc7\u5f88\u591a\u5b66\u751f\u5bf9RESTful\u7684\u6982\u5ff5\u8fd8\u4e0d\u662f\u5f88\u6e05\u6670\u3002\u4e3a\u6b64\u6211\u89c9\u5f97\u6709\u5fc5\u8981\u5199\u7bc7\u8bf4\u660e\u4e00\u4e0b\u3002<\/p>\n<h3>\u76ee\u5f55\uff1a<\/h3>\n<ul>\n<li>\u4ec0\u4e48\u662frestful API<\/li>\n<li>restful API \u8bbe\u8ba1\u6307\u5357<\/li>\n<li>\u6781\u7aef\u60c5\u51b5\u4e0b\u67e5\u8be2\u662f\u8be5\u7528get\u8fd8\u662fpost?<\/li>\n<li>\u53c2\u8003\u6587\u7ae0<\/li>\n<\/ul>\n<h3>\u4e00\uff0c \u4ec0\u4e48\u662fRESTful API\uff1f<\/h3>\n<p><a href=\"http:\/\/en.wikipedia.org\/wiki\/Representational_state_transfer\" target=\"_blank\" rel=\"noopener\">RESTful API<\/a>\u662f\u76ee\u524d\u6bd4\u8f83\u6210\u719f\u7684\u4e00\u5957\u4e92\u8054\u7f51\u5e94\u7528\u7a0b\u5e8f\u7684API\u8bbe\u8ba1\u98ce\u683c\u3002\u5b83\u7684\u76ee\u7684\u5c31\u662f\u8ba9\u7b26\u5408\u8be5\u98ce\u683c\u7684web\u5e94\u7528\u7a0b\u5e8f\u7684\u63a5\u53e3\u53d8\u5f97\u6784\u6e05\u6670\u3001\u7b26\u5408\u6807\u51c6\u3001\u6613\u4e8e\u7406\u89e3\u3001\u6269\u5c55\u65b9\u4fbf\u3002<\/p>\n<p>\u4e0b\u9762\u662f<a href=\"https:\/\/api.github.com\">github\u7f51\u7ad9\u7684restful\u98ce\u683cAPI\u7684\u793a\u4f8b\u6587\u6863<\/a>\uff0c\u6211\u60f3\u80fd\u591f\u7ed9\u60f3\u8981\u4e86\u89e3\u4ec0\u4e48\u662frestful api\u7684\u670b\u53cb\u975e\u5e38\u76f4\u89c2\u7684\u611f\u53d7\u3002\u90a3\u5c31\u662f\uff0c\u57fa\u4e8erestful\u98ce\u683c\u8bbe\u8ba1\u7684API\uff0c\u5728\u6700\u4f73\u7684\u5e94\u7528\u573a\u666f\u4e2d\uff0c\u4f60\u751a\u81f3\u4e0d\u7528\u9605\u8bfbAPI\u8bf4\u660e\u6587\u6863\uff0c\u53ea\u8981\u9605\u8bfb\u8fd9\u4e2aURL\uff0c\u5c31\u80fd\u641e\u6e05\u695a\u8fd9\u4e2aAPI\u662f\u505a\u4ec0\u4e48\u7684\uff0c\u6709\u54ea\u4e9b\u53c2\u6570\u3002<\/p>\n<pre class=\"lang:default decode:true\">{\n  \"current_user_url\": \"https:\/\/api.github.com\/user\",\n  \"current_user_authorizations_html_url\": \"https:\/\/github.com\/settings\/connections\/applications{\/client_id}\",\n  \"authorizations_url\": \"https:\/\/api.github.com\/authorizations\",\n  \"code_search_url\": \"https:\/\/api.github.com\/search\/code?q={query}{&amp;page,per_page,sort,order}\",\n  \"emails_url\": \"https:\/\/api.github.com\/user\/emails\",\n  \"emojis_url\": \"https:\/\/api.github.com\/emojis\",\n  \"events_url\": \"https:\/\/api.github.com\/events\",\n  \"feeds_url\": \"https:\/\/api.github.com\/feeds\",\n  \"following_url\": \"https:\/\/api.github.com\/user\/following{\/target}\",\n  \"gists_url\": \"https:\/\/api.github.com\/gists{\/gist_id}\",\n  \"hub_url\": \"https:\/\/api.github.com\/hub\",\n  \"issue_search_url\": \"https:\/\/api.github.com\/search\/issues?q={query}{&amp;page,per_page,sort,order}\",\n  \"issues_url\": \"https:\/\/api.github.com\/issues\",\n  \"keys_url\": \"https:\/\/api.github.com\/user\/keys\",\n  \"notifications_url\": \"https:\/\/api.github.com\/notifications\",\n  \"organization_repositories_url\": \"https:\/\/api.github.com\/orgs\/{org}\/repos{?type,page,per_page,sort}\",\n  \"organization_url\": \"https:\/\/api.github.com\/orgs\/{org}\",\n  \"public_gists_url\": \"https:\/\/api.github.com\/gists\/public\",\n  \"rate_limit_url\": \"https:\/\/api.github.com\/rate_limit\",\n  \"repository_url\": \"https:\/\/api.github.com\/repos\/{owner}\/{repo}\",\n  \"repository_search_url\": \"https:\/\/api.github.com\/search\/repositories?q={query}{&amp;page,per_page,sort,order}\",\n  \"current_user_repositories_url\": \"https:\/\/api.github.com\/user\/repos{?type,page,per_page,sort}\",\n  \"starred_url\": \"https:\/\/api.github.com\/user\/starred{\/owner}{\/repo}\",\n  \"starred_gists_url\": \"https:\/\/api.github.com\/gists\/starred\",\n  \"team_url\": \"https:\/\/api.github.com\/teams\",\n  \"user_url\": \"https:\/\/api.github.com\/users\/{user}\",\n  \"user_organizations_url\": \"https:\/\/api.github.com\/user\/orgs\",\n  \"user_repositories_url\": \"https:\/\/api.github.com\/users\/{user}\/repos{?type,page,per_page,sort}\",\n  \"user_search_url\": \"https:\/\/api.github.com\/search\/users?q={query}{&amp;page,per_page,sort,order}\"\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>RESTful \u7684\u6838\u5fc3\u601d\u60f3\u5c31\u662f\uff0c\u5ba2\u6237\u7aef\u53d1\u51fa\u7684\u6570\u636e\u64cd\u4f5c\u6307\u4ee4\u90fd\u662f&#8221;\u52a8\u8bcd + \u5bbe\u8bed&#8221;\u7684\u7ed3\u6784\u3002\u4f8b\u5982\uff0cGET\/user,\u00a0 GET\u662f\u52a8\u8bcd\uff0c\u8868\u793a\u8981\u505a\u4ec0\u4e48\uff0cuser\u662f\u540d\u8bcd\uff0c\u8868\u793a\u4ee3\u8868\u4e86\u4ec0\u4e48\u8d44\u6e90\u3002<\/p>\n<p>\u4e3a\u4e86\u907f\u514d\u968f\u610f\u5b9a\u4e49\u52a8\u8bcd\u9020\u6210\u7684\u8bed\u4e49\u6df7\u4e71\uff0cRESTful\u8981\u6c42API\u8bbe\u8ba1\u8005\u90fd\u4f7f\u7528HTTP\u534f\u8bae\u6307\u5b9a\u76845\u79cd\u65b9\u6cd5\u4f5c\u4e3a\u52a8\u8bcd\u3002\u8fd9\u4e94\u79cd\u65b9\u6cd5\u662f\uff1a<\/p>\n<blockquote><p>GET\uff1a\u8bfb\u53d6\u67d0\u4e2a\u8d44\u6e90\uff08Read\uff09<br \/>\nPOST\uff1a\u65b0\u5efa\u67d0\u4e2a\u8d44\u6e90\uff08Create\uff09<br \/>\nPUT\uff1a\u66f4\u65b0\u67d0\u4e2a\u8d44\u6e90\uff08Update\uff09<br \/>\nPATCH\uff1a\u90e8\u5206\u66f4\u65b0\u67d0\u4e2a\u8d44\u6e90\uff08Update\uff09<br \/>\nDELETE\uff1a\u5220\u9664\u67d0\u4e2a\u8d44\u6e90\uff08Delete\uff09<\/p><\/blockquote>\n<p>\u6709\u4e9b\u5ba2\u6237\u7aef\u53ea\u80fd\u4f7f\u7528GET\u548cPOST\u8fd9\u4e24\u79cd\u65b9\u6cd5\u3002\u90a3\u4e48PUT\u3001PATCH\u3001DELETE\u5c31\u5f97\u7528POST\u65b9\u6cd5\u6a21\u62df\u3002\u8fd9\u65f6\uff0c\u5ba2\u6237\u7aef\u53d1\u51fa\u7684 HTTP \u8bf7\u6c42\uff0c\u8981\u52a0\u4e0a<code>X-HTTP-Method-Override<\/code>\u5c5e\u6027\uff0c\u544a\u8bc9\u670d\u52a1\u5668\u5e94\u8be5\u4f7f\u7528\u54ea\u4e00\u4e2a\u52a8\u8bcd\uff0c\u8986\u76d6<code>POST<\/code>\u65b9\u6cd5\u3002<\/p>\n<p>\u9650\u5b9a\u4e86\u52a8\u8bcd\u7684\u60c5\u51b5\u4e0b\uff0cAPI\u8bbe\u8ba1\u8005\u53ea\u9700\u8981\u60f3\u597d\u7528\u4ec0\u4e48\u540d\u8bcd\u6765\u8868\u793a\u8d44\u6e90\u5c31\u53ef\u4ee5\u4e86\u3002\u5c31\u50cfgithub\u505a\u7684\u90a3\u6837\u3002<\/p>\n<h3>\u4e8c\uff0c restful API \u8bbe\u8ba1\u6307\u5357<\/h3>\n<p>(1) \u7b80\u5355CRUD\u7684API\u5bf9\u6bd4\uff1a<\/p>\n<blockquote><p>\u975erestful\u98ce\u683curl:<br \/>\n\u67e5\u8be2\u4e00\u4e2a\u7528\u6237 \/user\/query?name=tom \uff08GET\uff09<br \/>\n\u67e5\u8be2\u7528\u6237\u8be6\u60c5 \/user\/query?id=1\uff08GET\uff09<br \/>\n\u521b\u5efa\u4e00\u4e2a\u7528\u6237 \/user\/create?name=tom \uff08POST\uff09<br \/>\n\u4fee\u6539\u4e00\u4e2a\u7528\u6237 \/user\/update?id=1&amp;name=jerry \uff08POST\uff09<br \/>\n\u5220\u9664\u4e00\u4e2a\u7528\u6237 \/user\/delete?id=1 \uff08GET\uff09<\/p>\n<p>restful\u98ce\u683c\u7684url\uff1a<br \/>\n\u67e5\u8be2\u4e00\u4e2a\u7528\u6237 \/user?name=tom \uff08GET\uff09<br \/>\n\u67e5\u8be2\u7528\u6237\u8be6\u60c5 \/user\/1 \uff08GET\uff09<br \/>\n\u521b\u5efa\u4e00\u4e2a\u7528\u6237 \/user \uff08POST\uff09<br \/>\n\u4fee\u6539\u4e00\u4e2a\u7528\u6237 \/user\/1 \uff08PUT\uff09<br \/>\n\u5220\u9664\u4e00\u4e2a\u7528\u6237 \/user\/1 \uff08DELETE\uff09<\/p><\/blockquote>\n<p>\u662f\u4e0d\u662f\u53d1\u73b0restful\u98ce\u683c\u7684API\u7b80\u6d01\u4e86\u5f88\u591a\uff1f<\/p>\n<p>(2)\u5bf9\u4e8e\u6761\u4ef6\u67092\u9879\u7684\u67e5\u8be2\uff0c\u907f\u514d\u5199\u6210\u591a\u7ea7\u7684URL\uff0c\u6bd4\u5982\u6bd4\u5982\u83b7\u53d6\u67d0\u4e2a\u4f5c\u8005\u7684\u67d0\u4e00\u7c7b\u6587\u7ae0\uff0c\u4e0d\u5e94\u8be5\u5199\u6210\uff1a<br \/>\nGET \/authors\/12\/categories\/2<br \/>\n\u800c\u5e94\u5199\u6210\uff1a<br \/>\nGET \/authors\/12?categories=2<\/p>\n<p>(3)\u5982\u679c\u67e5\u8be2\u6761\u4ef6\u5927\u4e8e3\u9879\u600e\u4e48\u529e?<\/p>\n<p>\u8fd9\u91cc\u6211\u4eec\u53c2\u8003github\u8bbe\u8ba1\u8f83\u4e3a\u590d\u6742\u67e5\u8be2\u7684\u4f8b\u5b50\uff1a<\/p>\n<p>&#8220;user_search_url&#8221;: &#8220;https:\/\/api.github.com\/search\/users?q={query}{&amp;page,per_page,sort,order}&#8221;<\/p>\n<p>\u8fd9\u662f\u4e00\u4e2a\u7528\u6237\u67e5\u8be2\u63a5\u53e3\uff0c\u6709\u6700\u591a5\u4e2a\u53c2\u6570\uff1aquery(\u67e5\u8be2\u5185\u5bb9)\uff0cpage\uff08\u9875\u7801\uff09,per_page\uff08\u6bcf\u9875\u663e\u793a\u591a\u5c11\u4e2a\u7ed3\u679c\uff09,sort \uff08\u6392\u5e8f\u65b9\u5f0f\uff09, order\uff08\u6307\u4ee4\uff09\u3002\u9664\u4e86query\u4ee5\u5916\u5176\u4ed64\u4e2a\u53c2\u6570\u90fd\u662f\u53ef\u9009\u7684\u3002github\u7684\u63a5\u53e3\u8bbe\u8ba1\u65b9\u5f0f\u662f\uff0c\u628a\u8fd9\u4e9b\u53c2\u6570\u7ec4\u6210\u4e00\u4e2a\u957f\u5b57\u7b26\u4e32\u6765\u53d1\u9001\uff0c\u4e2d\u95f4\u7528&amp;\u548c\u9017\u53f7\u5206\u9694\u3002<\/p>\n<h3>\u4e09\uff0c\u6781\u7aef\u60c5\u51b5\u4e0b\u67e5\u8be2\u662f\u8be5\u7528get\u8fd8\u662fpost?<\/h3>\n<p>\u7531\u4e8e\u6211\u4eec\u505a\u7684\u662f\u6570\u636e\u5206\u6790\u9879\u76ee\uff0c\u56e0\u6b64\u7ecf\u5e38\u4f1a\u9047\u5230\u5927\u89c4\u6a21\u7684\u6570\u636e\u67e5\u8be2\uff0c\u5e76\u4e14\u67e5\u8be2\u53c2\u6570\u975e\u5e38\u590d\u6742\u3002<\/p>\n<p>\u8003\u8651\u4e00\u79cd\u6781\u7aef\u60c5\u51b5\uff1a\u67e5\u8be2\u53c2\u6570\u662f\u4e00\u4e2a\u8d85\u957f\u7684\u6570\u7ec4\uff0c\u5c31\u50cf\u8fd9\u4e2a\u6837\u5b50\uff1a[931, 241, 1181\uff0c1131\uff0c6311 &#8230;&#8230;] \u8fd9\u4e2a\u6570\u7ec4\u4e2d\u6bcf\u4e2a\u6570\u5b57\u90fd\u662f\u4e00\u4e2a\u8282\u70b9id\uff0c\u6ca1\u6709\u987a\u5e8f\u6027\u79d1\u7814\uff0c\u6574\u4e2a\u53ef\u80fd\u6709\u6570\u767e\u3001\u4e0a\u5343\u4e2a\u5b57\u7b26\u90a3\u4e48\u957f\uff0c\u3002\u6700\u540e\u8981\u6c42API\u8fd4\u56de\u8be5\u6570\u7ec4\u63d0\u4f9b\u7684\u6bcf\u4e2a\u8282\u70b9id\u5bf9\u5e94\u7684\u5168\u90e8\u7edf\u8ba1\u9879\u3002\u8fd4\u56de\u7ed3\u679c\u5927\u6982\u662f\u8fd9\u6837\uff1a<\/p>\n<p>[<\/p>\n<p>{id:931, degree_in:31, degree_out:101, total_num: 3111},<\/p>\n<p>{id:241, degree_in:51, degree_out:90, total_num: 123},<\/p>\n<p>&#8230;&#8230;<\/p>\n<p>]<\/p>\n<p>\u50cf\u8fd9\u6837\u7684\u590d\u6742\u67e5\u8be2\uff0c\u8be5\u600e\u4e48\u5b9e\u73b0\uff1f<\/p>\n<p>\u663e\u7136\uff0c\u8fd9\u4e0d\u662f\u4e00\u4e2a\u901a\u7528API\uff0c\u9700\u8981\u6587\u6863\u624d\u80fd\u8bfb\u61c2\u7ed3\u679c\u3002<\/p>\n<p>\u5176\u6b21\uff0c\u67e5\u8be2\u53c2\u6570\u8fc7\u957f\uff0c\u5f88\u53ef\u80fd\u8d85\u8fc7get\u8bf7\u6c422K\u957f\u5ea6\u7684\u9650\u5236\u3002<\/p>\n<p>\u6240\u4ee5\uff0c\u8fd9\u79cd\u65f6\u5019\u5c31\u522b\u62d8\u6ce5\u4e8erestful\u6807\u51c6\u4e0b\u53ea\u6709get\u8bf7\u6c42\u624d\u80fd\u505a\u67e5\u8be2\u7684\u8981\u6c42\u4e86\u3002\u6700\u597d\u7684\u89e3\u51b3\u65b9\u6cd5\u8fd8\u662f\u5c06\u67e5\u8be2\u53c2\u6570\u5c01\u88c5\u6210JSON\uff0c\u4f7f\u7528POST\u8bf7\u6c42\u4f20\u8f93\uff0c\u7136\u540e\u8fd4\u56deJSON\u3002<\/p>\n<p>\u770b\u770bstackoverflow\u4e0a\u5173\u4e8e\u8fd9\u79cdcomplex query\u95ee\u9898\u7684\u89e3\u7b54\uff0c\u5176\u4ed6\u56de\u7b54\u8005\u4e5f\u662f\u63a8\u8350\u7528post<br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/37166714\/restful-api-complex-queries\">https:\/\/stackoverflow.com\/questions\/37166714\/restful-api-complex-queries<\/a><br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/381983\/what-is-the-best-way-to-create-restful-complex-queries\">https:\/\/stackoverflow.com\/questions\/381983\/what-is-the-best-way-to-create-restful-complex-queries<\/a><\/p>\n<div class=\"answercell post-layout--right\">\n<div class=\"post-text\">\n<blockquote><p>POST is the method to use for any operation that isn&#8217;t standardized by HTTP. Retrieval is standardized by the GET method, so using POST to retrieve information that corresponds to a potential resource is never RESTful. In theory, you should use GET, regardless of how convoluted your URI turns out to be.<\/p>\n<p>However, since you&#8217;re performing a query for which there isn&#8217;t a single resource you could perform a GET to, it seems fine to use POST, as long as you&#8217;re aware of the disadvantages and your documentation is clear about it. Frankly, I think using a POST is much clearer than encoding that payload as a JSON + base64 and sending it as a querystring merely for purism.<\/p>\n<p>The real issue with using POST is when people use it in such a way that it avoids or prevents using a real URI. That doesn&#8217;t seem to be the issue in your case, since you have a valid URI for the collection, but the semantics of your query are too complex to be expressed easily.<\/p>\n<p>If you decide to go with GET, there&#8217;s a catch. While the HTTP specs establish no limit for URIs, most implementations do, and you might hit that limit if you need to feed all those parameters as a querystring. In that case, it&#8217;s RESTful to circumvent limitations of the underlying implementation, as long as that&#8217;s decoupled from your application. A convention for doing what you want would be to use the POST method with the payload you described above, and the\u00a0<code>X-HTTP-Method-Override: GET<\/code>\u00a0header.<\/p><\/blockquote>\n<\/div>\n<p>\u5982\u679c\u4f60\u662frestful\u539f\u6559\u65e8\u4e3b\u4e49\u8005\uff0c\u90a3\u4e48\u6709\u4e24\u6761\u8def\u53ef\u8d70\uff1a \u65b9\u6cd5\u4e00\uff0c\u8fd8\u662f\u7528GET\u8bf7\u6c42\uff0c\u7528JSON + base64 \u7684\u65b9\u5f0f\u6784\u9020\u8bf7\u6c42\u53c2\u6570\uff0c\u5982\u679c\u8bf7\u6c42\u53c2\u6570\u592a\u957f\uff0c\u5c31\u5206\u51e0\u6b21\u4f20\u8f93\u3002\u663e\u7136\u8fd9\u79cd\u65b9\u5f0f\u662f\u975e\u5e38\u9ebb\u70e6\u7684\u3002\u65b9\u6cd5\u4e8c\uff0c\u7528post\u8bf7\u6c42\uff0c\u7136\u540e\u52a0\u4e0a\u00a0X-HTTP-Method-Override: GET\uff0c\u6765\u5047\u88c5\u5b83\u662f\u4e00\u4e2a\u6ee1\u8db3restful\u98ce\u683c\u8981\u6c42\u7684GET\u8bf7\u6c42\u3002\u65e2\u6ee1\u8db3\u4e86\u539f\u6559\u65e8\u4e3b\u4e49\u9700\u6c42\uff0c\u53c8\u8282\u7701\u4e86\u529f\u592b\uff0c\u5c82\u4e0d\u7f8e\u54c9\uff1f<\/p>\n<p>\u5f53\u7136\u6211\u89c9\u5f97\u6211\u4e0d\u662f\u4e00\u4e2a\u539f\u6559\u65e8\u4e3b\u4e49\u8005\u3002<\/p>\n<h3>\u56db\uff0c\u53c2\u8003\u6587\u7ae0<\/h3>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u975e\u5e38\u597d\u7684\u53c2\u8003\u6587\u7ae0\uff0c\u53ef\u4ee5\u7528\u6765\u6269\u5927\u89c6\u91ce\uff0c\u66f4\u597d\u5730\u8bbe\u8ba1API<\/p>\n<ul>\n<li><a href=\"http:\/\/www.ruanyifeng.com\/blog\/2018\/10\/restful-api-best-practices.html\">RESTful API \u6700\u4f73\u5b9e\u8df5<\/a><\/li>\n<li><a href=\"https:\/\/www.cnblogs.com\/xishuai\/p\/restful-webapi-uri-design.html\">RESTful API URI \u8bbe\u8ba1\u7684\u4e00\u4e9b\u603b\u7ed3<\/a><\/li>\n<li><a href=\"http:\/\/www.restapitutorial.com\/lessons\/restfulresourcenaming.html\">Resource Naming<\/a><\/li>\n<li><a href=\"http:\/\/www.vinaysahni.com\/best-practices-for-a-pragmatic-restful-api\">Best Practices for Designing a Pragmatic RESTful API<\/a><\/li>\n<li><a href=\"http:\/\/kb.cnblogs.com\/page\/521718\/\">\u64b0\u5199\u5408\u683c\u7684 REST API<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/darcyliu\/google-styleguide\/blob\/master\/JSONStyleGuide.md\">JSON \u98ce\u683c\u6307\u5357<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u6700\u65e9\u63a5\u89e6RESTful API\u8fd9\u4e2a\u4e1c\u897f<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[17,48],"class_list":["post-1946","post","type-post","status-publish","format-standard","hentry","category-8","tag-api","tag-restful"],"_links":{"self":[{"href":"https:\/\/www.divis.cn\/index.php\/wp-json\/wp\/v2\/posts\/1946","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.divis.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.divis.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.divis.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.divis.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1946"}],"version-history":[{"count":0,"href":"https:\/\/www.divis.cn\/index.php\/wp-json\/wp\/v2\/posts\/1946\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.divis.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1946"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.divis.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1946"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.divis.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1946"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}