{"id":174555,"date":"2013-03-28T13:14:03","date_gmt":"2013-03-28T09:14:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=174555"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=174555","title":{"rendered":"<span class=\"post_title\">\u041a\u0430\u043a \u044f \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u0432\u043e\u043b\u043d\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u0441\u0442\u0430\u043b \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 restful API<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/bb2\/5da\/6a2\/bb25da6a292bd52ee858c3c93735eb9c.jpg\"\/><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 API, \u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0435\u0433\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438. <a href=\"http:\/\/developers.facebook.com\">\u0411\u043e\u043b\u044c\u0448\u0438\u0435<\/a> <a href=\"https:\/\/dev.twitter.com\">\u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438<\/a> \u0434\u0435\u043b\u0430\u044e\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0440\u0442\u0430\u043b\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e, \u0438\u043b\u0438 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443-\u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043b\u044e\u0431\u0438\u043c\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430 (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 API \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044f) \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u0440\u0443\u0434\u043e\u0437\u0430\u0442\u0440\u0430\u0442\u043d\u043e\u0435 \u0434\u0435\u043b\u043e. \u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0441 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0438 \u044d\u0442\u043e \u043d\u0430\u043f\u0440\u044f\u0433\u0430\u0435\u0442. \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437:  <\/p>\n<ul>\n<li>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0435, \u0447\u0442\u043e \u0432\u0441\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/li>\n<li>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0435, \u0447\u0442\u043e \u0432\u0441\u0451 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/li>\n<\/ul>\n<p><a name=\"habracut\"><\/a><br \/>  \u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0443\u043d\u043a\u0442 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u0440\u0435\u0431\u044f\u0442\u0430 \u0438\u0437 \u0441\u0442\u0430\u0440\u0442\u0430\u043f\u0430 <a href=\"http:\/\/apiary.io\">apiary.io<\/a>, \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u044f\u0437\u044b\u043a\u0435 (DSL), \u0430 \u043f\u043e\u0442\u043e\u043c, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u0440\u043e\u043a\u0441\u0438 \u043a \u0432\u0430\u0448\u0435\u043c\u0443 API \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0438 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u0447\u0442\u043e \u0432\u0441\u0451 \u043e\u043f\u0438\u0441\u0430\u043d\u043e\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0432\u0430\u043c \u0432\u0441\u0451 \u0435\u0449\u0451 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u0438\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0438 \u044d\u0442\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u043d\u0438\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u044b \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0443\u0436\u0435 \u043e\u043f\u0438\u0441\u0430\u043b\u0438 \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432 \u0432\u0438\u0434\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0438\u0437 \u043a\u043e\u0434\u0430 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0435\u0441\u0442\u044c \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0442\u043e \u0442\u0430\u043a\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, <a href=\"http:\/\/roy.gbiv.com\/untangled\/2008\/rest-apis-must-be-hypertext-driven\">\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442<\/a> <a href=\"http:\/\/en.wikipedia.org\/wiki\/HATEOAS\">\u043c\u043d\u0435\u043d\u0438\u0435<\/a>, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0430\u043c \u043f\u043e\u043d\u044f\u0442\u044c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 REST API, \u0437\u043d\u0430\u044f \u0442\u043e\u043b\u044c\u043a\u043e URL \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 media types. \u041d\u043e \u044f \u043d\u0435 \u0432\u0438\u0434\u0435\u043b \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u043e\u0433\u043e \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e API, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434. <\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e, \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 <a href=\"http:\/\/www.w3.org\/TR\/wsdl20\">WSDL<\/a>, \u043d\u043e \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f\u043c\u0438 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0445 REST.<\/p>\n<p>  \u0415\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432:<\/p>\n<ul>\n<li> <a href=\"http:\/\/www.w3.org\/Submission\/wadl\">WADL<\/a> \u2014 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f XML \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f, \u0430 \u044d\u0442\u043e \u0434\u0430\u0432\u043d\u043e \u043d\u0435 \u043c\u043e\u0434\u043d\u043e.<\/li>\n<li> <a href=\"https:\/\/github.com\/wordnik\/swagger-core\/wiki\">Swagger spec<\/a> \u2014 \u0444\u043e\u0440\u043c\u0430\u0442 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 <a href=\"https:\/\/developers.helloreverb.com\/swagger\/\">Swagger<\/a>, \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 json, \u0435\u0441\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0434\u043b\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u043c.<\/li>\n<li><a href=\"https:\/\/developers.google.com\/discovery\">Google API discovery document<\/a> \u2014 \u0444\u043e\u0440\u043c\u0430\u0442 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 Google \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0432\u043e\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432.<\/li>\n<li><a href=\"http:\/\/www.mashery.com\/product\/io-docs\">I\\O docs<\/a> \u2014 \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0444\u043e\u0440\u043c\u0430\u0442, \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u043d\u0430 \u0433\u0443\u0433\u043b\u043e\u0432\u044b\u0439.<\/li>\n<li>\u0421\u0432\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442. <\/li>\n<\/ul>\n<p>  \u042f \u0432\u044b\u0431\u0440\u0430\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0447\u0435\u0441\u0442\u044c \u0432\u0441\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0432\u0430\u0448\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0432\u0440\u043e\u0434\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438\\\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0438\u0442\u0434. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u043d\u0435 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0438\u0434\u0435\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043d\u0430 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u0432 \u043e\u0434\u043d\u043e\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 (\u0430 \u043a\u0430\u043a \u0436\u0435 \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f?), \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u043e \u0432\u0441\u0435\u0445 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u0445.<br \/>  \u041f\u043e\u043c\u0438\u043c\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043a API. \u0422\u0430\u043a\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0441\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439, \u0438 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f API. <\/p>\n<h4>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h4>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0442\u0435\u043c, \u043a\u0442\u043e \u0434\u0430\u043b\u0451\u043a \u043e\u0442 <a href=\"http:\/\/www.asp.net\/web-api\">ASP.NET WebAPI<\/a>. \u0418\u0442\u0430\u043a, \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c API \u043d\u0430 \u044d\u0442\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435 \u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u043d\u0443\u0436\u0435\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043c\u0435\u0447\u0430\u0442\u044c \u044d\u043a\u0448\u0435\u043d\u044b \u0438 \u0442\u0438\u043f\u044b, \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u043f\u0430\u0434\u0443\u0442 \u0432 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<pre><code class=\"cs\">    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false)]     public class MetaAttribute : Attribute     {              } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0445\u0435\u043c\u044b \u0442\u0438\u043f\u043e\u0432 (\u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 <a href=\"http:\/\/json-schema.org\/\">json schema<\/a>, \u043d\u043e \u043f\u0440\u043e\u0449\u0435), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 API:<\/p>\n<pre><code class=\"cs\">    public class TypeMetadataController : ApiController     {         private readonly Assembly typeAssembly;          public TypeMetadataController(Assembly typeAssembly)         {             this.typeAssembly = typeAssembly;         }          [OutputCache]         public IEnumerable&lt;ApiType&gt; Get()         {             return this.typeAssembly                 .GetTypes()                 .Where(t =&gt; Attribute.IsDefined(t, typeof(MetaAttribute)))                 .Select(GetApiType);         }          [OutputCache]         public ApiType Get(String name)         {             var type = this.Get().FirstOrDefault(t =&gt; t.Name == name);             if (type == null)                 throw new ResourceNotFoundException&lt;ApiType, String&gt;(name);              return type;         }          ApiType GetApiType(Type type)         {             var dataContractAttribute = type.GetCustomAttribute&lt;DataContractAttribute&gt;();              return new ApiType             {                 Name = dataContractAttribute != null ? dataContractAttribute.Name : type.Name,                 DocumentationArticleId = dataContractAttribute != null ? dataContractAttribute.Name : type.Name,                 Properties = type.GetMembers()                             .Where(p =&gt; p.IsDefined(typeof(DataMemberAttribute), false))                             .Select(p =&gt;                             {                                 var dataMemberAttribute = p.GetCustomAttributes(typeof (DataMemberAttribute), false).First() as DataMemberAttribute;                                 return new ApiTypeProperty                                 {                                     Name = dataMemberAttribute != null ? dataMemberAttribute.Name : p.Name,                                     Type = ApiType.GetTypeName(GetMemberUnderlyingType(p)),                                     DocumentationArticleId = String.Format(&quot;{0}.{1}&quot;, dataContractAttribute != null ? dataContractAttribute.Name : type.Name, dataMemberAttribute != null ? dataMemberAttribute.Name : p.Name)                                 };                             }                 ).ToList()             };         }          static Type GetMemberUnderlyingType(MemberInfo member)         {             switch (member.MemberType)             {                 case MemberTypes.Field:                     return ((FieldInfo)member).FieldType;                 case MemberTypes.Property:                     return ((PropertyInfo)member).PropertyType;                 default:                     throw new ArgumentException(&quot;MemberInfo must be if type FieldInfo or PropertyInfo&quot;, &quot;member&quot;);             }         }     } <\/code><\/pre>\n<p>  \u041e\u0447\u0435\u043d\u044c \u043c\u0430\u043b\u043e\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0442\u0438\u043f\u044b \u0431\u0443\u0434\u0443\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043a\u044d\u0448\u0438\u0440\u0443\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<br \/>  \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043c\u0435\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c API, \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.web.http.description.iapiexplorer(v=vs.108).aspx\">IApiExplorer<\/a>. <\/p>\n<pre><code class=\"cs\">    public class ResourceMetadataController : ApiController     {         private readonly IApiExplorer apiExplorer;          public ResourceMetadataController(IApiExplorer apiExplorer)         {             this.apiExplorer = apiExplorer;         }          [OutputCache]         public IEnumerable&lt;ApiResource&gt; Get()         {             var controllers = this.apiExplorer                .ApiDescriptions                .Where(x =&gt; x.ActionDescriptor.ControllerDescriptor.GetCustomAttributes&lt;MetaAttribute&gt;().Any() || x.ActionDescriptor.GetCustomAttributes&lt;MetaAttribute&gt;().Any())                .GroupBy(x =&gt; x.ActionDescriptor.ControllerDescriptor.ControllerName)                .Select(x =&gt; x.First().ActionDescriptor.ControllerDescriptor.ControllerName)                .ToList();              return controllers.Select(GetApiResourceMetadata).ToList();         }          ApiResource GetApiResourceMetadata(string controller)         {             var apis = this.apiExplorer              .ApiDescriptions              .Where(x =&gt;                  x.ActionDescriptor.ControllerDescriptor.ControllerName == controller &&                  ( x.ActionDescriptor.GetCustomAttributes&lt;MetaAttribute&gt;().Any() || x.ActionDescriptor.ControllerDescriptor.GetCustomAttributes&lt;MetaAttribute&gt;().Any() )              ).GroupBy(x =&gt; x.ActionDescriptor);                          return new ApiResource             {                 Name = controller,                 Requests = apis.Select(g =&gt; this.GetApiRequest(g.First(), g.Select(d =&gt; d.RelativePath))).ToList(),                 DocumentationArticleId = controller             };         }          ApiRequest GetApiRequest(ApiDescription api, IEnumerable&lt;String&gt; uris)         {             return new ApiRequest             {                 Name = api.ActionDescriptor.ActionName,                 Uris = uris.ToArray(),                 DocumentationArticleId = String.Format(&quot;{0}.{1}&quot;, api.ActionDescriptor.ControllerDescriptor.ControllerName, api.ActionDescriptor.ActionName),                 Method = api.HttpMethod.Method,                 Parameters = api.ParameterDescriptions.Select( parameter =&gt;                      new ApiRequestParameter                     {                         Name = parameter.Name,                         DocumentationArticleId = String.Format(&quot;{0}.{1}.{2}&quot;, api.ActionDescriptor.ControllerDescriptor.ControllerName, api.ActionDescriptor.ActionName, parameter.Name),                         Source = parameter.Source.ToString().ToLower().Replace(&quot;from&quot;,&quot;&quot;),                         Type = ApiType.GetTypeName(parameter.ParameterDescriptor.ParameterType)                     }).ToList(),                 ResponseType = ApiType.GetTypeName(api.ActionDescriptor.ReturnType),                 RequiresAuthorization = api.ActionDescriptor.GetCustomAttributes&lt;RequiresAuthorization&gt;().Any()             };         }     } <\/code><\/pre>\n<p>  \u0412\u043e \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u0445 \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u0435 <i>`DocumentationArticleId`<\/i> \u044d\u0442\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u0442\u0430\u0442\u044c\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 json \u0444\u0430\u0439\u043b\u0435 \u0438\u043b\u0438 \u0432 \u0431\u0434.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/f63\/5a0\/c8f\/f635a0c8fe6b009a0d41a787830ec0b0.png\"\/><\/p>\n<p>  \u0421 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f <a href=\"https:\/\/github.com\/idmitriev\/ApiMeta\">\u043d\u0430 GitHub<\/a>.    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/company\/dnevnik_ru\/blog\/174555\/\"> http:\/\/habrahabr.ru\/company\/dnevnik_ru\/blog\/174555\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/bb2\/5da\/6a2\/bb25da6a292bd52ee858c3c93735eb9c.jpg\"\/><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 API, \u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0435\u0433\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438. <a href=\"http:\/\/developers.facebook.com\">\u0411\u043e\u043b\u044c\u0448\u0438\u0435<\/a> <a href=\"https:\/\/dev.twitter.com\">\u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438<\/a> \u0434\u0435\u043b\u0430\u044e\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0440\u0442\u0430\u043b\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e, \u0438\u043b\u0438 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443-\u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043b\u044e\u0431\u0438\u043c\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430 (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 API \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044f) \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u0440\u0443\u0434\u043e\u0437\u0430\u0442\u0440\u0430\u0442\u043d\u043e\u0435 \u0434\u0435\u043b\u043e. \u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0441 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0438 \u044d\u0442\u043e \u043d\u0430\u043f\u0440\u044f\u0433\u0430\u0435\u0442. \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437:  <\/p>\n<ul>\n<li>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0435, \u0447\u0442\u043e \u0432\u0441\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/li>\n<li>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0435, \u0447\u0442\u043e \u0432\u0441\u0451 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/li>\n<\/ul>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-174555","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/174555","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=174555"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/174555\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=174555"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=174555"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=174555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}