Contents tagged with WebApi

  • Azure API Management Resources

    Although I know my HTTP and Web API pretty well, becoming an API Evangelist on the Azure API Management team means also needing to know the nitty gritty of the Azure API Management product too.  In my learning process I have discovered a wealth of useful information, but it is scattered around a little.  Some is on the Azure documentation site, some on Channel 9, some on YouTube and some awesome content from our Microsoft MVPs.  This post is my attempt to gather it together to make it a bit easier to find.  Continue reading...

  • Are You Or Your Customers Leaking Your API Keys?

    Several months ago I wrote a post called Where, oh where, does the API key go?  I encouraged API providers to allow consumers to put the API Key in the Authorization header to help avoid accidental disclosure of keys via things like web server logs.  I recently bumped into a way that anyone can harvest hundreds of API keys from many different web sites, including ones that charge significant amounts of money for access. Continue reading...

  • Share Your Code, Not Your API Keys

    Part of my role at Runscope involves me writing OSS libraries or sample projects to share with other developers.  I also regularly use 3rd party APIs in the process.  This requires the use of API keys and other private data that I'd rather not share.  Unfortunately it is all too easy to leave a key in a source code file and accidentally commit it to a public source control repository. Continue reading...

  • Centralized exception handling using a ASP.NET Web API MessageHandler

    ASP.NET Web API 2.1 introduced some significant improvements to the mechanisms that support global error handling. Before this release there were a number of different types of errors that would be handled directly by the runtime and there was no easy way to intercept these errors and add your own custom behavior.  The standard guidance suggests you register these new handlers as services, but I prefer a different approach that seems more natural to me. Continue reading...

  • These 8 lines of code can make debugging your ASP.Net Web API a little bit easier.

    I think most us ASP.Net Web API developers have, at some point, experienced the problem where their API is returning a 500 Internal Server Error, but tracing through with Visual Studio doesn't reveal any exceptions in our code.  This problem is often caused when a MediaTypeFormatter is unable to serialize an object.  This simple message handler can take away some of the pain of debugging these scenarios. Continue reading...

  • Composing API responses for maximum reuse with ASP.NET Web API

    In Web API 2.1 a new mechanism was introduced for returning HTTP messages that appeared to be a cross between HttpResponseMessage and the ActionResult mechanism from ASP.NET MVC.  At first I wasn't a fan of it at all.  It appeared to add little new value and just provide yet another alternative that would a be a source of confusion.  It wasn't until I saw an example produced by Brad Wilson that I was convinced that it had value. Continue reading...

  • Posting raw JSON to Web API

    I see questions almost weekly on StackOverflow where someone is trying to POST JSON and receive it as a string.  The problem is that Web API has two modes, “serialized object” and “HTTP message”.  Receiving raw JSON as a string falls between the two. Continue reading...

  • 1

comments powered by Disqus