APP<\/a>PI \u63a5\u53e3\u7684\u529f\u80fd\uff1a\u9996\u5148\u9700\u8981\u660e\u786e API \u63a5\u53e3\u7684\u4f5c\u7528\u4ee5\u53ca\u5177\u4f53\u7684\u5b9e\u73b0\u65b9\u5f0f\uff0c\u53d6\u5f97\u7b2c\u4e00\u6b65\u7684\u6210\u529f\u3002<\/p>\n2.\u5408\u7406\u5730\u8bbe\u8ba1 API \u63a5\u53e3\u7684 URL\uff08\u7edf\u4e00\u8d44\u6e90\u5b9a\u4f4d\u5668\uff09\uff1aURL \u4e0d\u80fd\u968f\u610f\u7f16\u5199\uff0c\u5fc5\u987b\u6709\u89c4\u8303\uff0c\u65b9\u4fbf\u524d\u540e\u7aef\u5206\u79bb\u540e\u7684\u5bf9\u63a5\u3002\u5c3d\u91cf\u6309\u7167 RESTful \u7684\u89c4\u8303\u6765\u8bbe\u8ba1 URL\u3002<\/p>\n
3.\u5408\u7406\u5730\u8bbe\u8ba1 API \u63a5\u53e3\u7684\u53c2\u6570\uff1a\u5728\u8bbe\u8ba1\u53c2\u6570\u65f6\uff0c\u4e00\u5b9a\u8981\u660e\u786e\u53c2\u6570\u7684\u4f5c\u7528\u548c\u7c7b\u578b\uff0c\u5e76\u4e14\u8981\u6ce8\u610f\u53c2\u6570\u7684\u5b89\u5168\u6027\u548c\u9632\u7be1\u6539\u6027\uff0c\u4ee5\u53ca\u907f\u514d\u53c2\u6570\u7684\u5197\u4f59\u3002<\/p>\n
4.\u4f7f\u7528\u6807\u51c6\u7684 HTTP \u65b9\u6cd5\uff1aHTTP \u534f\u8bae\u4e2d\u7684\u8bf7\u6c42\u65b9\u6cd5\u6709 GET\u3001POST\u3001PUT\u3001DELETE \u7b49\uff0c\u8981\u6839\u636e\u4e0d\u540c\u7684\u5e94\u7528\u573a\u666f\uff0c\u9009\u62e9\u5408\u9002\u7684 HTTP \u65b9\u6cd5\u3002<\/p>\n
5.\u4f7f\u7528\u6807\u51c6\u7684\u72b6\u6001\u7801\uff1aHTTP response \u72b6\u6001\u7801\u662f\u6807\u51c6\u76843\u4f4d\u6570\u5b57\uff0c\u7528\u4e8e\u8868\u660e\u670d\u52a1\u5668\u54cd\u5e94\u7684\u72b6\u6001\u3002\u4e0d\u540c\u7684\u72b6\u6001\u7801\u8868\u660e\u4e86\u4e0d\u540c\u7684\u542b\u4e49\uff0c\u8981\u6309\u7167\u5b9e\u9645\u573a\u666f\u5408\u7406\u8bbe\u7f6e\u72b6\u6001\u7801\u3002<\/p>\n
6.\u5408\u7406\u5730\u8bbe\u8ba1 API \u63a5\u53e3\u7684\u8fd4\u56de\u7ed3\u679c\uff1aAPI \u8fd4\u56de\u7ed3\u679c\u53ef\u4ee5\u4f7f\u7528 JSON \u6216 XML \u7b49\u6570\u636e\u4ea4\u6362\u683c\u5f0f\u3002\u5728\u8bbe\u8ba1\u8fd4\u56de\u7ed3\u679c\u65f6\uff0c\u9700\u8981\u8003\u8651\u8fd4\u56de\u7c7b\u578b\u3001\u8fd4\u56de\u72b6\u6001\u3001\u8fd4\u56de\u4fe1\u606f\u7b49\u53c2\u6570\u3002<\/p>\n
API \u63a5\u53e3\u8bbe\u8ba1\u7684\u6ce8\u610f\u4e8b\u9879\uff1a<\/p>\n
1.\u53c2\u6570\u9a8c\u8bc1\uff1a\u6240\u6709\u53c2\u6570\u90fd\u5e94\u8be5\u5177\u6709\u6709\u6548\u6027\u9a8c\u8bc1\u673a\u5236\uff0c\u786e\u4fdd\u4f20\u5165\u7684\u503c\u7b26\u5408\u6211\u4eec\u9884\u8bbe\u7684\u6570\u636e\u7c7b\u578b\u548c\u6570\u636e\u8303\u56f4\u3002<\/p>\n
2.\u8eab\u4efd\u9a8c\u8bc1\u548c\u6388\u6743\u9a8c\u8bc1\uff1aAPI \u63a5\u53e3\u7684\u8bbf\u95ee\u91cf\u53ef\u80fd\u5f88\u9ad8\uff0c\u6211\u4eec\u9700\u8981\u5bf9 API \u8fdb\u884c\u8eab\u4efd\u9a8c\u8bc1\u548c\u6388\u6743\u9a8c\u8bc1\uff0c\u4ee5\u786e\u4fdd\u53ea\u6709\u6388\u6743\u7528\u6237\u624d\u53ef\u4ee5\u8bbf\u95ee\u548c\u4f7f\u7528 API\u3002<\/p>\n
\n
<\/figure>\n<\/p>\n3.\u8003\u8651\u8bf7\u6c42\u548c\u54cd\u5e94\u7684\u5927\u5c0f\u548c\u901f\u5ea6\uff1a\u6bcf\u4e2a\u8bf7\u6c42\u90fd\u9700\u8981\u8003\u8651\u5e26\u5bbd\u548c\u54cd\u5e94\u901f\u5ea6\u7684\u5f71\u54cd\uff0c\u6211\u4eec\u9700\u8981\u8fdb\u884c\u4f18\u5316\u3002<\/p>\n
4.API \u7248\u672c\u63a7\u5236\uff1a\u5728\u4e0d\u65ad\u7684\u8fed\u4ee3\u548c\u4f18\u5316\u8fc7\u7a0b\u4e2d\uff0cAPI \u63a5\u53e3\u529f\u80fd\u53ef\u80fd\u4f1a\u53d1\u751f\u53d8\u5316\u3002\u5728\u6539\u53d8 API \u529f\u80fd\u65f6\uff0c\u9700\u8981\u8003\u8651\u7248\u672c\u95ee\u9898\uff0c\u4ee5\u517c\u5bb9\u4e4b\u524d\u7248\u672c\u7684 API\u3002<\/p>\n
\u7efc\u4e0a\u6240\u8ff0\uff0cAPI \u7684\u4f5c\u7528\u5728\u4e8e\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u548c\u964d\u4f4e\u5f00\u53d1\u590d\u6742\u5ea6\uff0c\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u5bf9 API \u63a5\u53e3\u8fdb\u884c\u5408\u7406\u7684\u8bbe\u8ba1\uff0c\u5e76\u5236\u5b9a\u76f8\u5e94\u7684\u89c4\u5219\u548c\u6ce8\u610f\u4e8b\u9879\uff0c\u540c\u65f6\u4e0d\u65ad\u4f18\u5316\u548c\u8fed\u4ee3\uff0c\u4ee5\u4fdd\u8bc1\u63a5\u53e3\u7684\u9ad8\u6548\u7a33\u5b9a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
API\uff08Application Programming Interface\uff0c\u5e94\u7528\u7a0b\u5e8f\u7f16\u7a0b\u63a5\u53e3\uff09\u662f\u6307\u5728\u8f6f\u4ef6\u5de5\u7a0b\u4e2d\uff0c\u63d0\u4f9b\u7ed9\u5176\u4ed6\u8f6f\u4ef6\u7684\u63a5\u53e3\u3002API \u901a\u5e38\u662f\u7531\u5e93\u3001\u51fd\u6570\u3001\u7c7b\u6216\u65b9\u6cd5\u7b49\u65b9\u6cd5\u63d0\u4f9b\u7684\uff0c\u5e76\u4e14\u5728\u8f6f\u4ef6\u5f00\u53d1\u8fc7<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[4154,795,6551,1126,2271],"topic":[],"class_list":["post-3238","post","type-post","status-publish","format-standard","hentry","category-appkf","tag-h5apk","tag-795","tag-app-h5","tag-1126","tag-2271"],"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/3238","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=3238"}],"version-history":[{"count":0,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/3238\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=3238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=3238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=3238"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=3238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}