Well, after a few hours of chasing my tail the past few days, I figured I needed to share some of my learnings. As I have blogged before, I have been working with Simple.Web to build out my projects lately. Yesterday, I started to write an API for a product and, when I attempted to test it, got a lovely 415 error from the application. Well, I forgot to add the XML and JSON serializers to the project so the application didn't know how to respond to the request.
So, if attempting to use Simple.Web for an HTTP API, don't forget to add your serializers! (They are easily installed via NuGet, just like the Simple.Web core.)
For JSON requests, you can use either the Simple.Web.JsonNet package or the Simple.Web.JsonFx package. For XML requests, you can use the Simple.Web.Xml package. Of course, Simple.Web is flexible enough that you could also write your own if you don't the current ones.
So, if you're building an HTTP API using Simple.Web, save yourself some time and install the serializers up front so you don't waste as much time as I did!
No comments:
Post a Comment