<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Creating a Web API that Supports CRUD Operations</title><link>http://www.asp.net</link><pubDate>Mon, 16 Jul 2012 14:46:47 GMT</pubDate><generator>umbraco</generator><description>Comments for Creating a Web API that Supports CRUD Operations</description><language>en</language><atom:link href="http://www.asp.net/rss/comments/36899" rel="self" type="application/rss+xml" /><item><title>Comment Posted by Kees C. Bakker</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Sat, 18 Feb 2012 05:20:33 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000014870</guid><description><![CDATA[ <p>Wonderful tutorial. I would love to see it done with Entity Framework as there might be some tricky things like validation and stuff. But good job!</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/Kees%20C.%20Bakker.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by shadi</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Sun, 19 Feb 2012 04:35:33 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000014877</guid><description><![CDATA[ <p>Good and easy to understand tutorial. </p><p>I think it would be better if this article include with jQuery code like in the first introductory article.</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/shadi.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by shadi</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Sun, 19 Feb 2012 04:42:06 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000014878</guid><description><![CDATA[ <p>I just notice that this article came with working sample that can be downloaded in Samples section. It should be mentioned somewhere in this tutorial.</p><p>I know it is still in beta, and you guys ahve done a good job in publishing the tutorials and samples.</p><p></p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/shadi.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by InterTed</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Mon, 12 Mar 2012 05:29:14 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015096</guid><description><![CDATA[ <p>This is great stuff! Question; will Upshot.js support these RESTful API&#39;s in SPA applications?</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/InterTed.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by dthein</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Tue, 03 Apr 2012 11:17:30 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015248</guid><description><![CDATA[ <p>The PutContact(int id, Contact contact) does not seem to work properly. The id parameter is not getting populated from the request URI but instead from the Contact object passed in the request body.  Not good. :-(</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/dthein.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by hemanshubhojak</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Sun, 15 Apr 2012 14:07:49 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015328</guid><description><![CDATA[ <p>How can we accept csv values in an API method? For example, if I want to get contacts with id 1, 3 and 8.</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/hemanshubhojak.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by davidgrayuk</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Wed, 25 Apr 2012 05:46:59 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015407</guid><description><![CDATA[ <p>Shouldn&#39;t this be a Factory at least? I appreciate this is not an article on patterns but some newer guys might not be aware that you are removing the loose coupling of an interface by assigning a concrete instance inline?</p><p></p><p>static readonly IContactRepository _repository = new ContactRepository();</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/davidgrayuk.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by kahanu</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Mon, 14 May 2012 16:18:41 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015506</guid><description><![CDATA[ <p>Nice, but how do you handle this scenario?</p><p></p><p>Get all comments for an article</p><p></p><p></p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/kahanu.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by mkamoski2</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Wed, 16 May 2012 11:37:00 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015518</guid><description><![CDATA[ <p>Dear Mike Watson -- This is a great article. However, I am finding that regarding this....  var response = Request.CreateResponse&lt;Product&gt;(HttpStatusCode.Created, item);  ....causes a CTE of something like &quot;CreateResponse&quot; cannot accept typed arguments.... and the non-typed version only takes 1 param, the StatusCode. Also, I am finding that for this.... string uri = Url.Link(&quot;DefaultApi&quot;, new { id = item.Id });  ....the UrlHelper does not have a &quot;Link&quot; method... so I am skipping that part. Regardless, it is a good article. Thanks. -- Mark Kamoski</p><p>		</p><p></p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/mkamoski2.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by mkamoski2</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Fri, 18 May 2012 15:57:57 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015557</guid><description><![CDATA[ <p>Dear Mike Wasson -- Please help. How can one call this from the code-behind of an ASP.NET ASPX page using C# and POST? Can you show a quick code sample? I have RetrieveAll and RetrieveOne working with WebApi. But, for some reason, I cannot get the CreateOne to wire-up with POST, and the service call just times out. Etc. Please advise. Thanks. -- Mark Kamoski</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/mkamoski2.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by pclion</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Tue, 29 May 2012 05:18:38 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015617</guid><description><![CDATA[ <p>good article!</p><p>but the two line can&#39;t to be compiled:</p><p>Request.CreateResponse&lt;Product&gt;(HttpStatusCode.Created, item);</p><p>Url.Link(&quot;DefaultApi&quot;, new { id = item.Id });</p><p></p><p>how to fix it?</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/pclion.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by bevans</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Wed, 30 May 2012 12:12:52 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015629</guid><description><![CDATA[ <p>Mike, there are a couple of errors that have already been documented in the comments.  Are there any plans to fix these?</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/bevans.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by MikeWasson</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Fri, 01 Jun 2012 17:37:09 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015648</guid><description><![CDATA[ <p>@bevans: I have updated the tutorial for the RC - if there are still any issues, let me know! - Mike</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/MikeWasson.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by mgaber2020</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Mon, 04 Jun 2012 03:53:06 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015668</guid><description><![CDATA[ <p>very useful article thanks so much</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/mgaber2020.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by nifke</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Tue, 05 Jun 2012 13:12:29 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015684</guid><description><![CDATA[ <p>the PostProduct method doesn&#39;t build.</p><p></p><p>Request.CreateResponse&lt;Product&gt; and Url.Link(... </p><p>don&#39;t build. Any ideas?</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/nifke.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by toddhd</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Thu, 07 Jun 2012 10:34:11 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015717</guid><description><![CDATA[ <p>I was getting the same error messages while trying to build. I decided to download the project code from the top of this page. When I did that and opened it, I recieved error messages from VS that some components (I&#39;m sorry, I don&#39;t remember the exact ones and didn&#39;t write it down) were not installed, and it offered to install them for me. It had something to do with MVC3 and also something about ASP.NET in general. This may have been because I installed VS 2010 recently, never had MVC3 on this and directly loaded MVC 4, so I think some components were missing. </p><p></p><p>Anyway, that fixed it. If you are getting the build problem, please try opening the provided solution. If you do, please post here as to what packages needed to be loaded. Thanks!</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/toddhd.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by me0pro</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Fri, 15 Jun 2012 04:43:49 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015774</guid><description><![CDATA[ <p>Mike Wasson,In VS11 under the normal debugging tutorial</p><p></p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/me0pro.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by Terry Duchastel</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Thu, 21 Jun 2012 17:47:34 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015816</guid><description><![CDATA[ <p>If you turn on static code analysis on the downloaded project you get 3 warnings.  Are we expected to ignore these? </p><p></p><p>Warning	1	CA2000 : Microsoft.Reliability : In method &#39;ProductsController.GetProduct(int)&#39;, object &#39;new HttpResponseMessage(HttpStatusCode.NotFound)&#39; is not disposed along all exception paths. Call System.IDisposable.Dispose on object &#39;new HttpResponseMessage(HttpStatusCode.NotFound)&#39; before all references to it are out of scope.	C:\Users\terrydu\Desktop\Web API CRUD\C#\ProductStore\Controllers\ProductsController.cs	25	ProductStore</p><p>Warning	2	CA2000 : Microsoft.Reliability : In method &#39;ProductsController.PostProduct(Product)&#39;, object &#39;response&#39; is not disposed along all exception paths. Call System.IDisposable.Dispose on object &#39;response&#39; before all references to it are out of scope.	C:\Users\terrydu\Desktop\Web API CRUD\C#\ProductStore\Controllers\ProductsController.cs	41	ProductStore</p><p>Warning	3	CA2000 : Microsoft.Reliability : In method &#39;ProductsController.PutProduct(int, Product)&#39;, object &#39;new HttpResponseMessage(HttpStatusCode.NotFound)&#39; is not disposed along all exception paths. Call System.IDisposable.Dispose on object &#39;new HttpResponseMessage(HttpStatusCode.NotFound)&#39; before all references to it are out of scope.	C:\Users\terrydu\Desktop\Web API CRUD\C#\ProductStore\Controllers\ProductsController.cs	54	ProductStore</p><p></p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/Terry%20Duchastel.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by MikeWasson</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Fri, 22 Jun 2012 00:03:27 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015819</guid><description><![CDATA[ <p>Terry: Yes, the response message will get disposed later in the pipeline. You can add a SuppressMessage attribute to suppress the warning. Thanks for pointing that out!</p><p></p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/MikeWasson.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by Terry Duchastel</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Fri, 22 Jun 2012 19:16:46 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015827</guid><description><![CDATA[ <p>Thanks Mike!  I noticed that HttpResponseException is one of the things that changed between the Beta and the RC.  Do you know if there will be more changes to HttpResponseException?  I admit I&#39;m a little leery of just suppressing this warning (for the whole method), though I suppose I can mitigate the impact somewhat by isolating it.</p><p></p><p>Great tutorial btw.</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/Terry%20Duchastel.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by ntaiji</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Sun, 08 Jul 2012 18:29:06 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015941</guid><description><![CDATA[ <p>pclion, I have met the same error.</p><p></p><p>check your code,</p><p>correct is &quot; public class ProductsController : ApiController &quot;</p><p>but default vs created is &quot; public class ProductsController : Controller &quot; </p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/ntaiji.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by ntaiji</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Mon, 09 Jul 2012 01:17:46 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015942</guid><description><![CDATA[ <p>This tutrial is very cool. Is it possible to use this way at IIS6 ? </p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/ntaiji.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by ettery</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Thu, 12 Jul 2012 10:54:23 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015961</guid><description><![CDATA[ <p>Hi Mike, thanks for this sample, it has been informative, but the api only allows a full list or query on ID (I tried to add query on code to the controller, but got an error indicating that Id was required).  I am trying to find a sample which will show me how to build an OData service which will allow be to use the OData specified query URIs to query my EF data model (<a rel="nofollow" href="http://www.odata.org/developers/protocols/uri-conventions" target="_blank">www.odata.org/</a>#QueryStringOptions).  Any ideas?</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/ettery.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by cgcarter1</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Fri, 13 Jul 2012 16:00:49 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015975</guid><description><![CDATA[ <p>I would rate this as a 1.</p><p>Although you give good example code (for those getting the error on Request.CreateResponse - Using System.Net.Http), but you give no example models or anything.  This is pretty much on the useless end of worthless.  It mimics much of the useless Microsoft MSDN writings that do nothing but confuse and frustrate the developer.</p><p>You go into great detail of the Get methods but end it with a slight mention of the Delete method. Update gets even less attention.</p><p>Worthless.</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/cgcarter1.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by MikeWasson</title><link>http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations</link><pubDate>Mon, 16 Jul 2012 14:46:47 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015988</guid><description><![CDATA[ <p>@cgcarter1: The Product class is the only model in this example. For the PUT and DELETE methods, I figured they are reasonably straightforward, once you&#39;ve seen the pattern for GET and POST. The main considerations are (a) do you return anything in the response body; (b) what status code to return. But if I left out something that seems important, let me know.</p><p></p><p>I should add: There are definitely other things to consider, e.g. model validation, that I didn&#39;t cover here. </p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/MikeWasson.jpg?forceidenticon=false&amp;dt=635048436000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item></channel></rss>