Monday, May 20, 2013

Web API FromUrl and FromBody

I've been using ASP.NET Web API for new service my lone .NET customer. They needed to build a most html/js application into the company intranet and they are only interested in Microsoft Technologies so I figured this would give me something similar to RESTful resources in Rails.

While the WebAPI certainly seems modeled after that, and it's a noble effort, I've been struggling to get routes working the way I want running into issues with nested resources and using parameters in the url. The preferred solution seems to be to use IQueryable and OData,  I don't use an ORM that implements IQueryable, and I wasn't willing to switch. So I have stumbled onto the pattern of using FromUrl to at least pass parameters in a more complex than the standard way.