{"id":155021,"date":"2012-10-17T17:29:03","date_gmt":"2012-10-17T13:29:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=155021"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=155021","title":{"rendered":"<span class=\"post_title\">\u0423\u0434\u043e\u0431\u043d\u043e\u0435 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043d\u0438\u0435 RESTful API \u0432 \u043f\u0440\u043e\u0435\u043a\u0442<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041d\u0438 \u0434\u043b\u044f \u043a\u043e\u0433\u043e \u043d\u0435 \u0441\u0435\u043a\u0440\u0435\u0442, \u0447\u0442\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 API \u0438\u0434\u0435\u0442 \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u0443 \u043b\u044e\u0431\u043e\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443. \u041d\u043e \u0447\u0430\u0441\u0442\u043e, \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435 \u0432 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438\u043b\u0438 \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0435\u0433\u043e \u043a \u0433\u043e\u0442\u043e\u0432\u043e\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443, \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b \u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u043d\u0438\u043c\u0430\u044e\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>  \u042f \u0445\u043e\u0447\u0443 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0443 \u043d\u0430\u0448 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 RESTful \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b API, \u0431\u0435\u0437 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0438 \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430, \u043d\u0430\u043c\u0438 \u0431\u044b\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e <a href=\"https:\/\/github.com\/paysio\/yii-rest-api\">\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0434\u043b\u044f Yii Framework<\/a>, \u043d\u043e \u0441\u0430\u043c \u043f\u043e\u0434\u0445\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0432 \u043b\u044e\u0431\u043e\u0439 MVC \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 <code>RestUserController<\/code> \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438:  <\/p>\n<ul>\n<li><code>actionIndex<\/code> \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/li>\n<li><code>actionView<\/code> \u2014 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/li>\n<li><code>actionCreate<\/code> \u2014 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/li>\n<li><code>actionUpdate<\/code> \u2014 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/li>\n<li><code>actionDelete<\/code> \u2014 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/li>\n<\/ul>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c <code>RestUser<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f <i>ActvieRecord<\/i> \u0442\u0430\u0431\u043b\u0438\u0446\u044b <i>rest_users<\/i>.<\/p>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043c\u0435\u0442\u043e\u0434 <code>actionCreate<\/code>, \u0437\u0430\u0434\u0430\u0447\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f <code>RestUser<\/code>,  <\/p>\n<pre><code class=\"php\">class RestUserController extends Controller {     ...     public function actionCreate()     {         $model = new RestUser();          if (isset($_POST) && ($data = $_POST)) { \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043b\u0438 POST \u0437\u0430\u043f\u0440\u043e\u0441              $model-&gt;attributes = $data; \/\/ \u043f\u0438\u0448\u0435\u043c \u0432 \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u043e\u0432\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b             if ($model-&gt;save()) { \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b, \u0435\u0441\u043b\u0438 \u0432\u0430\u043b\u0438\u0434\u043d\u044b - \u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c                 $this-&gt;redirect(array('view', 'id' =&gt; $model-&gt;id));             }         }         $this-&gt;render('create', array('model' =&gt; $model)); \/\/ \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c html-\u0444\u043e\u0440\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f     }     ... } <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u0432\u0441\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u2014 \u0435c\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c <code>\/restUser\/create<\/code> \u2014 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f html-\u0444\u043e\u0440\u043c\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0435\u0441\u043b\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c <i>POST-\u0437\u0430\u043f\u0440\u043e\u0441<\/i> \u043d\u0430 \u044d\u0442\u043e\u0442 \u0430\u0434\u0440\u0435\u0441, \u0442\u043e \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043b\u043e\u0433\u0438\u043a\u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0437\u0430\u0442\u0435\u043c \u043b\u0438\u0431\u043e \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u0441 \u043d\u0430 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043b\u0438\u0431\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 html-\u0444\u043e\u0440\u043c\u0443 c \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0437 \u0441\u0432\u043e\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u2014 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0435 API. <br \/>  \u0422.\u043a. \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e RESTful \u0441\u0442\u0438\u043b\u0435, \u0442\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0433\u043e \u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0447\u0435\u0440\u0435\u0437 <i>curl<\/i>, \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<h6>\u0417\u0430\u043f\u0440\u043e\u0441<\/h6>\n<p>  <\/p>\n<pre><code class=\"bash\">curl http:\/\/test.local\/api\/users \\    -u demo:demo \\    -d email=&quot;user@test.local&quot; \\    -d password=&quot;passwd&quot; <\/code><\/pre>\n<p>  <\/p>\n<h6>\u041e\u0442\u0432\u0435\u0442<\/h6>\n<p>  <\/p>\n<pre><code class=\"bash\">&lt; HTTP\/1.1 201 Created &lt; Content-Type: application\/json &lt; WWW-Authenticate: Basic realm=&quot;App&quot; &lt; Location: http:\/\/test.local\/api\/users\/TEST_ID {     &quot;object&quot;:&quot;rest_user&quot;,     &quot;id&quot;:&quot;TEST_ID&quot;,     &quot;email&quot;:&quot;user@test.local&quot;,     &quot;name&quot;:&quot;Test REST User&quot; } <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0447\u0435\u0440\u0435\u0437 <i>HTTP basic auth<\/i> \u043b\u043e\u0433\u0438\u043d\u0430 demo \u0441 \u043f\u0430\u0440\u043e\u043b\u0435\u043c demo, \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b email \u0438 password, \u0432 \u043e\u0442\u0432\u0435\u0442, \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c JSON-\u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>  \u0412\u0441\u044f \u0438\u0434\u0435\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c <i>action-\u0430\u043c<\/i> \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 API-\u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u0432 <code>redirect<\/code> \u0438 <code>render<\/code>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u043c\u043e\u0434\u0435\u043b\u0435\u0439.<br \/>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u044d\u043a\u0441\u0435\u043f\u0448\u0435\u043d\u043e\u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0441\u0430\u043c\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 API-\u043a\u043b\u0438\u0435\u043d\u0442\u0443, \u043d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0430\u043c\u043e\u0439 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438 <i>action-\u043e\u0432<\/i> \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430.<\/p>\n<p>  \u0412 \u043d\u0430\u0448\u0435\u043c <a href=\"https:\/\/github.com\/paysio\/yii-rest-api\">\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0438<\/a> \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u043e\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0439 <code>onException<\/code> \u0438 <code>onError<\/code>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043a \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 <code>CActiveRecord<\/code> \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443 <code>CController<\/code> \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <a href=\"http:\/\/www.yiiframework.com\/wiki\/44\/behaviors-events\/#hh1\">\u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0439<\/a>.<br \/>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435, \u043a\u043e\u0434, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u043d\u0443\u0436\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442, \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0447\u0435\u0440\u0435\u0437 API, \u0438 html-\u0444\u043e\u0440\u043c\u0443 \u043f\u0440\u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435, \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"php\">class RestUserController extends Controller {     ...     public function actionCreate()     {         $model = new RestUser();          if ($this-&gt;isPost() && ($data = $_POST)) { \/\/ \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0441\u044f \u043c\u0435\u0442\u043e\u0434 isPost \u043d\u0430\u0440\u044f\u0434\u0443 \u0441 isPut \u0438 isDelete             $model-&gt;attributes = $data;             if ($model-&gt;save()) {                 $this-&gt;redirect(array('view', 'id' =&gt; $model), true, 201); \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442             }         }         $this-&gt;render('create', array('model' =&gt; $model), false, array('model')); \/\/ \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 \u0442\u043e\u043b\u044c\u043a\u043e model     }     ... } <\/code><\/pre>\n<p>  \u0412\u0430\u0436\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043e\u0442 \u043f\u0440\u0435\u0434\u0438\u0434\u0443\u0449\u0435\u0433\u043e \u2014 \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0432 \u043c\u0435\u0442\u043e\u0434 <code>redirect<\/code> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <code>id<\/code> \u043d\u0435 <code>$model-&gt;id<\/code>, \u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <code>$model<\/code>, \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0431\u044b\u043b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d \u043a\u043b\u0438\u0435\u043d\u0442\u0443. \u0422\u0430\u043a\u0436\u0435, \u0442\u0440\u0435\u0442\u044c\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 201 \u2014 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0432\u0438\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443, \u0442.\u043a. \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043e\u0442\u0432\u0435\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a <i>Location<\/i>, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0430\u0434\u0440\u0435\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430. HTTP-\u043a\u043e\u0434\u044b 3xx \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442\u0441\u044f.<br \/>  \u0415\u0449\u0451 \u043e\u0434\u043d\u0438\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <code>render<\/code>, \u0432 \u043d\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0435\u0439 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>$data<\/code>, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0443. \u0415\u0441\u043b\u0438 \u043f\u0440\u0430\u043c\u0435\u0442\u0440 <code>null<\/code> \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u0441\u044c \u043c\u0430\u0441\u0441\u0438\u0432 <code>$data<\/code>.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435, \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u043b\u0438\u0441\u044c \u0431\u044b \u0432 html-\u0444\u043e\u0440\u043c\u0435, \u0432\u0435\u0440\u043d\u0443\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435:<\/p>\n<h6>\u0417\u0430\u043f\u0440\u043e\u0441<\/h6>\n<p>  <\/p>\n<pre><code class=\"bash\">curl http:\/\/test.local\/api\/users \\    -u demo:demo \\    -d email=&quot;user@test.local&quot;  <\/code><\/pre>\n<p>  <\/p>\n<h6>\u041e\u0442\u0432\u0435\u0442<\/h6>\n<p>  <\/p>\n<pre><code class=\"bash\">&lt; HTTP\/1.1 400 Bad Request &lt; Content-Type: application\/json &lt; WWW-Authenticate: Basic realm=&quot;App&quot; { \t&quot;error&quot;:{ \t\t&quot;params&quot;:[ \t\t\t{ \t\t\t\t&quot;code&quot;:&quot;required&quot;, \t\t\t\t&quot;message&quot;:&quot;Password cannot be blank.&quot;, \t\t\t\t&quot;name&quot;:&quot;password&quot; \t\t\t} \t\t], \t\t&quot;type&quot;:&quot;invalid_param_error&quot;, \t\t&quot;message&quot;:&quot;Invalid data parameters&quot; \t} } <\/code><\/pre>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a-\u0442\u043e \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u2014 \u0443 \u043d\u0430\u0448\u0435\u0433\u043e <code>RestUser<\/code> \u044d\u0442\u043e \u043f\u043e\u043b\u0435 <code>password<\/code>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u043f\u043e\u043b\u0435\u0439.<br \/>  \u041f\u0440\u0430\u0432\u0438\u043b\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <code>rules<\/code>  <\/p>\n<pre><code class=\"php\">class RestUser extends CModel {     public function rules()     {         return array(             ...             array('id, email, name', 'safe', 'on' =&gt; 'render'),         );     } } <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0437\u0430\u0442\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u0443\u0447\u0442\u0435\u043d\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <code>getRenderAttributes<\/code>, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u0432 \u043c\u043e\u0434\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u0432\u0441\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b, \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u044f \u043f\u043e \u0441\u0432\u044f\u0437\u044f\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u0435.<\/p>\n<p>  \u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<br \/>  \u042f\u0434\u0440\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u0432\u043e\u043a\u0440\u0443\u0433 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 (\u0441\u0435\u0440\u0432\u0438\u0441\u0430) <code>\\rest\\Service<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445. \u0423 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0435\u0441\u0442\u044c \u0434\u0432\u0435 \u0433\u0440\u0443\u043f\u043f\u044b \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u043e\u0432 <code>auth<\/code> \u0438 <code>renderer<\/code>. <br \/>  \u0412 <code>auth<\/code> \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u044b, \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u2014 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0430\u0434\u0430\u043f\u0442\u0435\u0440 <i>HTTP basic auth<\/i>.<br \/>  \u0412 <code>renderer<\/code> \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u044b, \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0434\u0432\u0430 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0430 <i>JSON<\/i> \u0438 <i>XML<\/i>.<\/p>\n<h4>\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435<\/h4>\n<p>  <\/p>\n<h5>\u041a\u043e\u0440\u043e\u0442\u043a\u043e \u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445<\/h5>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 <code>main.php<\/code>  <\/p>\n<pre><code class=\"php\">YiiBase::setPathOfAlias('rest', realpath(__DIR__ . '\/..\/extensions\/yii-rest-api\/library\/rest'));  return array( \t'basePath' =&gt; dirname(__FILE__) . DIRECTORY_SEPARATOR . '..', \t'name' =&gt; 'My Web Application',  \t'preload' =&gt; array('restService'),  \t'import' =&gt; array( \t\t'application.models.*', \t\t'application.components.*', \t),  \t'components' =&gt; array(         'restService' =&gt; array(             'class'  =&gt; '\\rest\\Service',             'enable' =&gt;strpos($_SERVER['REQUEST_URI'], '\/api\/') !== false, \/\/ \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430         ),  \t\t'urlManager' =&gt; array( \t\t\t'urlFormat'      =&gt; 'path', \t\t\t'showScriptName' =&gt; false,             'baseUrl'        =&gt; '',             'rules'          =&gt; array(                 array('restUser\/index',  'pattern' =&gt; 'api\/v1\/users',                        'verb' =&gt; 'GET',   'parsingOnly' =&gt; true),                 array('restUser\/create', 'pattern' =&gt; 'api\/v1\/users',                        'verb' =&gt; 'POST', 'parsingOnly' =&gt; true),                 array('restUser\/view',   'pattern' =&gt; 'api\/v1\/users\/&lt;id&gt;',                        'verb' =&gt; 'GET', 'parsingOnly' =&gt; true),                 array('restUser\/update', 'pattern' =&gt; 'api\/v1\/users\/&lt;id&gt;',                        'verb' =&gt; 'PUT', 'parsingOnly' =&gt; true),                 array('restUser\/delete', 'pattern' =&gt; 'api\/v1\/users\/&lt;id&gt;',                        'verb' =&gt; 'DELETE', 'parsingOnly' =&gt; true),                  array('restUser\/index2',  'pattern' =&gt; 'api\/v2\/users',                        'verb' =&gt; 'GET', 'parsingOnly' =&gt; true), \/\/ \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e API             ) \t\t), \t), ); <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u044b  <\/p>\n<pre><code class=\"php\">\/**  * @method bool isPost()  * @method bool isPut()  * @method bool isDelete()  * @method string renderRest(string $view, array $data = null, bool $return = false, array $fields = array())  * @method void redirectRest(string $url, bool $terminate = true, int $statusCode = 302)  * @method bool isRestService()  * @method \\rest\\Service getRestService()  *\/ class RestUserController extends Controller {     public function behaviors()     {         return array(             'restAPI' =&gt; array('class' =&gt; '\\rest\\controller\\Behavior')         );     }     \/\/ \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u0435  $fields \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e, \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u043f\u043e\u043b\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \tpublic function render($view, $data = null, $return = false, array $fields = array('count', 'model', 'data')) \t{         if (($behavior = $this-&gt;asa('restAPI')) && $behavior-&gt;getEnabled()) {             if (isset($data['model']) && $this-&gt;isRestService() &&                  count(array_intersect(array_keys($data), $fields)) == 1) {                 $data = $data['model']; \/\/ \u043f\u043e \u043b\u043e\u0433\u0438\u043a\u0435 \u043d\u0430\u0448\u0435\u0433\u043e API, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043c\u044b \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c, \u043d\u043e \u0434\u0435\u0442\u0430\u043b\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 - \u043d\u0430 \u0432\u0430\u0448\u0435 \u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435                 $fields = null;             }             return $this-&gt;renderRest($view, $data, $return, $fields);         } else {             return parent::render($view, $data, $return);         }     }      public function redirect($url, $terminate = true, $statusCode = 302)     {         if (($behavior = $this-&gt;asa('restAPI')) && $behavior-&gt;getEnabled()) {             $this-&gt;redirectRest($url, $terminate, $statusCode);         } else {             parent::redirect($url, $terminate, $statusCode);         }     } } <\/code><\/pre>\n<p>  \u0412\u0441\u0435 \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u0438 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430  <\/p>\n<pre><code class=\"php\">\/**  * @method array getRenderAttributes(bool $recursive = true)  * @method string getObjectId()  *\/ class RestUser extends CActiveRecord {     \/**      * @return array      *\/     public function behaviors()     {         return array(             'renderModel' =&gt; array('class' =&gt; '\\rest\\model\\Behavior')         );     } } <\/code><\/pre>\n<h5>\u0421\u0441\u044b\u043b\u043a\u0438<\/h5>\n<p>  GitHub \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u2014 <a href=\"https:\/\/github.com\/paysio\/yii-rest-api\">github.com\/paysio\/yii-rest-api<\/a><br \/>  \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u2014 <a href=\"https:\/\/github.com\/paysio\/yii-rest-api#installation\">github.com\/paysio\/yii-rest-api#installation<\/a><br \/>  \u0412\u0435\u0441\u044c \u043a\u043e\u0434, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u2014 <a href=\"https:\/\/github.com\/paysio\/yii-rest-api\/tree\/master\/demo\">github.com\/paysio\/yii-rest-api\/tree\/master\/demo<\/a>    \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\/post\/155021\/\"> http:\/\/habrahabr.ru\/post\/155021\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041d\u0438 \u0434\u043b\u044f \u043a\u043e\u0433\u043e \u043d\u0435 \u0441\u0435\u043a\u0440\u0435\u0442, \u0447\u0442\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 API \u0438\u0434\u0435\u0442 \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u0443 \u043b\u044e\u0431\u043e\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443. \u041d\u043e \u0447\u0430\u0441\u0442\u043e, \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435 \u0432 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438\u043b\u0438 \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0435\u0433\u043e \u043a \u0433\u043e\u0442\u043e\u0432\u043e\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443, \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b \u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u043d\u0438\u043c\u0430\u044e\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>  \u042f \u0445\u043e\u0447\u0443 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0443 \u043d\u0430\u0448 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 RESTful \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b API, \u0431\u0435\u0437 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0438 \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438.  <\/p>\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-155021","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/155021","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=155021"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/155021\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=155021"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=155021"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=155021"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}