{"id":702,"date":"2020-03-20T03:04:00","date_gmt":"2020-03-20T03:04:00","guid":{"rendered":"http:\/\/bruceng.com\/dev\/?p=702"},"modified":"2020-03-20T03:04:00","modified_gmt":"2020-03-20T03:04:00","slug":"apicontroller-attribute-magic","status":"publish","type":"post","link":"https:\/\/bruceng.com\/dev\/?p=702","title":{"rendered":"ApiController attribute magic"},"content":{"rendered":"\n<p>While working with ASP.NET Core, I find that the [ApiController] attribute does a lot of magic to my controller.<\/p>\n\n\n\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/aspnet\/core\/web-api\/?view=aspnetcore-3.1#apicontroller-attribute\">https:\/\/docs.microsoft.com\/en-us\/aspnet\/core\/web-api\/?view=aspnetcore-3.1#apicontroller-attribute<\/a><\/p>\n\n\n\n<p>It will automatically throws 400 bad request error back to the client, parse the service model from the request payload, and a bunch of other things.<\/p>\n\n\n\n<p>I&#8217;m still not sure how model binding works without this attribute, maybe I would have to decorate the service with binding attributes for it to work.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While working with ASP.NET Core, I find that the [ApiController] attribute does a lot of magic to my controller. https:\/\/docs.microsoft.com\/en-us\/aspnet\/core\/web-api\/?view=aspnetcore-3.1#apicontroller-attribute It will automatically throws 400 bad request error back to the client, parse the service model from the request payload, and a bunch of other things. I&#8217;m still not sure how model binding works without &hellip; <a href=\"https:\/\/bruceng.com\/dev\/?p=702\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;ApiController attribute magic&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-702","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=\/wp\/v2\/posts\/702","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=702"}],"version-history":[{"count":1,"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=\/wp\/v2\/posts\/702\/revisions"}],"predecessor-version":[{"id":703,"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=\/wp\/v2\/posts\/702\/revisions\/703"}],"wp:attachment":[{"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=702"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}